Getting stuck at Django error: No module named registration

后端 未结 15 2207
一向
一向 2020-12-30 01:35

I installed the registration module, added it to settings.py. When I tried to run syncdb (% python sitename/manage.py syncdb --settings sitename.devsettings)

It gav

15条回答
  •  孤城傲影
    2020-12-30 01:53

    You mention sys.path so you might have tried this, however this was my problem and I'm sure some people reading this have it too.

    open the command prompt and enter (with the trailing slash):

    export PYTHONPATH=pathto/myproject/
    

    then enter:

    export DJANGO_SETTINGS_MODULE=settings
    

    This allows me to edit the settings.py file to list the INSTALLED_APPS like this:

    INSTALLED_APPS = (
        'django.contrib.admin',
        'django.contrib.auth',
        'django.contrib.contenttypes',
        'django.contrib.sessions',
        'django.contrib.sites',
        'myapp',
        'registration',
     )
    

    instead of:

    INSTALLED_APPS = (
        'django.contrib.admin',
        'django.contrib.auth',
        'django.contrib.contenttypes',
        'django.contrib.sessions',
        'django.contrib.sites',
        'myproject.myapp',
        'myproject.registration',
    )
    

提交回复
热议问题