I publish my blog on Django , on Pythonanywhere hosting. Static files gathered, migrate did.

In wsgi:

import os import sys path = '/home/nitrogen987654321/my-first-blog' # use your own username here if path not in sys.path: sys.path.append(path) os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings' from django.core.wsgi import get_wsgi_application from whitenoise.django import DjangoWhiteNoise application = DjangoWhiteNoise(get_wsgi_application()) 

Django = 1.8

Python = 3.4

Eventually:

enter image description here

What am I doing wrong? Tell me.

I try to execute wsgi line by line. does not generate an error, and only after adding the last line application = get_wsgi_application () produces the following errors: enter image description here

And the logs are as follows:

  2016-04-30 13:39:10,006 :Error running WSGI application Traceback (most recent call last): File "/bin/user_wsgi_wrapper.py", line 154, in __call__ app_iterator = self.app(environ, start_response) File "/bin/user_wsgi_wrapper.py", line 170, in import_error_application raise e File "/bin/user_wsgi_wrapper.py", line 154, in __call__ app_iterator = self.app(environ, start_response) File "/bin/user_wsgi_wrapper.py", line 170, in import_error_application raise e File "/bin/user_wsgi_wrapper.py", line 154, in __call__ app_iterator = self.app(environ, start_response) File "/bin/user_wsgi_wrapper.py", line 170, in import_error_application raise e File "/bin/user_wsgi_wrapper.py", line 154, in __call__ app_iterator = self.app(environ, start_response) File "/bin/user_wsgi_wrapper.py", line 170, in import_error_application raise e File "/bin/user_wsgi_wrapper.py", line 179, in <module> application = load_wsgi_application() File "/bin/user_wsgi_wrapper.py", line 175, in load_wsgi_application return __import__(os.environ['WSGI_MODULE'], globals(), locals(), ['application']).application File "/var/www/nitrogen987654321_pythonanywhere_com_wsgi.py", line 17, in <module> application = get_wsgi_application() File "/home/nitrogen987654321/my-first-blog/qblog/lib/python3.4/site-packages/django/core/wsgi.py", line 13, in get_wsgi_application django.setup() File "/home/nitrogen987654321/my-first-blog/qblog/lib/python3.4/site-packages/django/__init__.py", line 17, in setup configure_logging(settings.LOGGING_CONFIG, settings.LOGGING) File "/home/nitrogen987654321/my-first-blog/qblog/lib/python3.4/site-packages/django/conf/__init__.py", line 55, in __getattr__ self._setup(name) File "/home/nitrogen987654321/my-first-blog/qblog/lib/python3.4/site-packages/django/conf/__init__.py", line 43, in _setup self._wrapped = Settings(settings_module) File "/home/nitrogen987654321/my-first-blog/qblog/lib/python3.4/site-packages/django/conf/__init__.py", line 99, in __init__ mod = importlib.import_module(self.SETTINGS_MODULE) File "/home/nitrogen987654321/my-first-blog/qblog/lib/python3.4/importlib/__init__.py", line 109, in import_module return _bootstrap._gcd_import(name[level:], package, level) ImportError: No module named 'mysite' 
  • Well, is there any error log in the admin panel? - don Rumata
  • Try to write more detailed questions. Explain exactly what you see the problem, how to reproduce it, what you want to get as a result, etc. - Nicolas Chabanovsky
  • added logs ... - Maria Bristinina

1 answer 1

Setting up UWSGI is the most errant-generating stage of publishing from the DjangoGirls tutorial , so don’t worry.

First, in the settings there are links to the logs, see what's in them. Most likely it says what is wrong.

Secondly, check that the file structure on the server corresponds to what should be .

Thirdly, in the file with the uwsgi-config there is a path variable, it is worth checking that the username in it is correct. The easiest way is to run ls /home/nitrogen987654321/my-first-blog in the console.

  • "Setting up UWSGI is the most ergenerative step of publishing the DjangoGirls tutorial, so don't worry." - what is the reason? - titov_andrei
  • God knows. This is an empirical observation. - Lebedev Ilya
  • ran ls / home / nitrogen987654321 / my-first-blog .... issued: pycache activate.fish db.sqlite3 easy_install markdown_py pip3.4 python3 django-admin easy_install-3.4 pip python python3.4 site1 wheel activate.csh blog django-admin.py manage.py pip3 python-config qblog. The right way is Maria Bristinina
  • Not really. According to the structure, next to manage.py should be the folder mysite , but it is not (see issue ls ). This is also indicated by the error: No module named 'mysite' . - Lebedev Ilya