با سلام خدمت شما
ارور من مربوط میشه به جنگو :
من در فایل models.py در app به نام activity هیچ فایلی رو نمیتونم ایمپورت بکنم .
اروری که موقع اجرا هر دستور از manage.py دریافت می کنم (مثلا : python manage.py makemigrations ) :
Traceback (most recent call last): File "C:\Users\Administrator\Desktop\Django\src\instagram\manage.py", line 22, in <module> main() File "C:\Users\Administrator\Desktop\Django\src\instagram\manage.py", line 18, in main execute_from_command_line(sys.argv) File "C:\Users\Administrator\Desktop\Django\venv\lib\site-packages\django\core\management\__init__.py", line 446, in execute_from_command_line utility.execute() File "C:\Users\Administrator\Desktop\Django\venv\lib\site-packages\django\core\management\__init__.py", line 420, in execute django.setup() File "C:\Users\Administrator\Desktop\Django\venv\lib\site-packages\django\__init__.py", line 24, in setup apps.populate(settings.INSTALLED_APPS) File "C:\Users\Administrator\Desktop\Django\venv\lib\site-packages\django\apps\registry.py", line 116, in populate app_config.import_models() File "C:\Users\Administrator\Desktop\Django\venv\lib\site-packages\django\apps\config.py", line 269, in import_models self.models_module = import_module(models_module_name) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\importlib\__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1050, in _gcd_import File "<frozen importlib._bootstrap>", line 1027, in _find_and_load File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 688, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 883, in exec_module File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed File "C:\Users\Administrator\Desktop\Django\src\instagram\activity\models.py", line 5, in <module> from instagram.lib.base_models import BaseModel ModuleNotFoundError: No module named 'instagram.lib'
سلام لطفا کد هاتون رو بین سه تا بک تیک (`) قرار بدین و کد قسمتی که ارور دارین رو هم بذارین اینجا
سلام وقت بخیر
کد :
from django.contrib.auth import get_user_model
from django.db import models
from django.utils.translation import gettext_lazy as _
from instagram.content.models import Post
from instagram.LibraryFoInstagram.base_models import BaseModel
User = get_user_model()
class Comment(BaseModel):
caption = models.TextField(_("caption"))
user = models.ForeignKey(User, related_name='comments', on_delete=models.CASCADE)
post = models.ForeignKey(Post, related_name='comments', on_delete=models.CASCADE)
reply_to = models.ForeignKey('self', related_name='replies', on_delete=models.CASCADE)
def __str__(self):
return self.caption
class Like(BaseModel):
user = models.ForeignKey(User, related_name='likes', on_delete=models.CASCADE)
post = models.ForeignKey(Post, related_name='likes', on_delete=models.CASCADE)
def __str__(self):
return f"{self.user.username} => {self.post.id}"
ارور :
C:\Users\Administrator\Desktop\Django\venv\Scripts\python.exe C:/Users/Administrator/Desktop/Django/src/instagram/manage.py python manage.py runserver
Traceback (most recent call last):
File "C:\Users\Administrator\Desktop\Django\src\instagram\manage.py", line 22, in <module>
main()
File "C:\Users\Administrator\Desktop\Django\src\instagram\manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "C:\Users\Administrator\Desktop\Django\venv\lib\site-packages\django\core\management\__init__.py", line 446, in execute_from_command_line
utility.execute()
File "C:\Users\Administrator\Desktop\Django\venv\lib\site-packages\django\core\management\__init__.py", line 420, in execute
django.setup()
File "C:\Users\Administrator\Desktop\Django\venv\lib\site-packages\django\__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Users\Administrator\Desktop\Django\venv\lib\site-packages\django\apps\registry.py", line 116, in populate
app_config.import_models()
File "C:\Users\Administrator\Desktop\Django\venv\lib\site-packages\django\apps\config.py", line 269, in import_models
self.models_module = import_module(models_module_name)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "C:\Users\Administrator\Desktop\Django\src\instagram\activity\models.py", line 5, in <module>
from instagram.content.models import Post
ModuleNotFoundError: No module named 'instagram.content'
آیا مایل به ارسال نوتیفیکیشن و اخبار از طرف راکت هستید ؟