Issue
I was stuck with the process when I wanted to deploy django project on server today. When I run python manage.py runserver
on server, the terminal shows me this:
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/usr/lib/python2.7/site-packages/django/core/management/__init__.py", line 351, in execute_from_command_line
utility.execute()
File "/usr/lib/python2.7/site-packages/django/core/management/__init__.py", line 343, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/lib/python2.7/site-packages/django/core/management/__init__.py", line 177, in fetch_command
commands = get_commands()
File "/usr/lib/python2.7/site-packages/django/utils/lru_cache.py", line 101, in wrapper
result = user_function(*args, **kwds)
File "/usr/lib/python2.7/site-packages/django/core/management/__init__.py", line 72, in get_commands
for app_config in reversed(list(apps.get_app_configs())):
File "/usr/lib/python2.7/site-packages/django/apps/registry.py", line 137, in get_app_configs
self.check_apps_ready()
File "/usr/lib/python2.7/site-packages/django/apps/registry.py", line 124, in check_apps_ready
raise AppRegistryNotReady("Apps aren't loaded yet.")
django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.
The django version on the server is 1.8.5, and the local is 1.8.1. I doubt the version may cause this problem. But I also doubted the wsgi.py
wasn't written properly, here's the wsgi.py
:
import os
import sys
path = '/Users/Peterhon/Desktop/dict/'
if path not in sys.path:
sys.path.append(path)
os.chdir(path)
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "dict.settings")
import django
django.setup()
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
Here's the manage.py
file:
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "dict.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.arg)
When I run python manage.py check on server, the output is below:
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "dict.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
Could anyone give me some tips? Thanks too much
Solution
This could well be an issue with your Django settings. For example, I just had specified in LOGGING
a filename in a non-existent directory. As soon as I changed it to an existing directory, the issue was resolved.
Answered By - jbasko
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.