T
T
tetafro2016-02-29 09:57:47
Django
tetafro, 2016-02-29 09:57:47

How to rename a project correctly?

Renamed the project (meaning the folder that contains settings.py, wsgi.py, etc.). Corrected all imports and links. The project ends up with the following structure:

/var/www/notes/
    project/
        apps/
            app1/
            app2/
            __init__.py
        core/ <<< это раньше называлось "notes"
            __init__.py
            settings.py
            wsgi.py
            ...
        media/
        static/
        manage.py
    venv/

And everything runs fine via
./manage.py runserver
But as soon as I try to run via uWSGI
uwsgi --ini /etc/uwsgi/apps-available/notes.ini
I get an error (note: "notes" is the old project name):
Traceback (most recent call last):
  File "./core/wsgi.py", line 16, in <module>
    application = get_wsgi_application()
  File "/var/www/notes/venv/lib/python3.4/site-packages/django/core/wsgi.py", line 14, in get_wsgi_application
    django.setup()
  File "/var/www/notes/venv/lib/python3.4/site-packages/django/__init__.py", line 17, in setup
    configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
  File "/var/www/notes/venv/lib/python3.4/site-packages/django/conf/__init__.py", line 48, in __getattr__
    self._setup(name)
  File "/var/www/notes/venv/lib/python3.4/site-packages/django/conf/__init__.py", line 44, in _setup
    self._wrapped = Settings(settings_module)
  File "/var/www/notes/venv/lib/python3.4/site-packages/django/conf/__init__.py", line 92, in __init__
    mod = importlib.import_module(self.SETTINGS_MODULE)
  File "/var/www/notes/venv/lib/python3.4/importlib/__init__.py", line 109, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ImportError: No module named 'notes'

I am attaching the uSWGI config
[uwsgi]
plugin = python3
socket = /run/uwsgi/app/notes/socket
chdir = /var/www/notes/project
module = core.wsgi:application
home = /var/www/notes/venv
vacuum = True
master = True

And the wsgi.py file from the project
import os
from django.core.wsgi import get_wsgi_application

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "core.settings")
application = get_wsgi_application()

What am I doing wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Voronkov, 2016-02-29
@DmitryVoronkov

Did you change it in settings?
WSGI_APPLICATION = 'core.wsgi.application'

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question