>>>mezzanine.pages.modelsimportPageTraceback(mostrecentcalllast):File"<stdin>",line1,in<module>File"/usr/local/lib/python2.7/site-packages/mezzanine/pages/models.py",line2,in<module>fromdjango.dbimportmodelsFile"/usr/local/lib/python2.7/site-packages/django/db/__init__.py",line14,in<module>ifnotsettings.DATABASES:File"/usr/local/lib/python2.7/site-packages/django/utils/functional.py",line276,in__getattr__self._setup()File"/usr/local/lib/python2.7/site-packages/django/conf/__init__.py",line40,in_setupraiseImportError("Settings cannot be imported, because environment variable %s is undefined."%ENVIRONMENT_VARIABLE)ImportError:Settingscannotbeimported,becauseenvironmentvariableDJANGO_SETTINGS_MODULEisundefined.
Why this error?
DJANGO_SETTINGS_MODULE variable has been set up :
# +++++++++++ DJANGO +++++++++++# To use your own django app use code like this:importosimportsys## assuming your django settings file is at '/home/myname/mysite/settings.py' path='/home/sligozat/'ifpathnotinsys.path:sys.path.append(path)os.environ['DJANGO_SETTINGS_MODULE']='nettementvotre.settings'importdjango.core.handlers.wsgiapplication=django.core.handlers.wsgi.WSGIHandler()
Hi sligozat,
The standard PythonAnywhere Python consoles don't run any code before launching. If you want to import your models you will need to open a bash console, navigate to your Mezzanine app directory and launch a Python process via manage.py. This loads a Python process with all correct environment already set up. So in a bash console type:
2017-04-16 01:48:34,318 :Error running WSGI application
2017-04-16 01:48:34,318 :ImportError: No module named my_wsgi_file
2017-04-16 01:48:34,318 : File "/var/www/ipproject_pythonanywhere_com_wsgi.py", line 71, in <module>
2017-04-16 01:48:34,318 : from my_wsgi_file import application
help me out of this error please
Sorry, we have had to rate-limit your feedback sending. Please try again in a few moments...
Thanks for the feedback! Our tireless devs will get back to you soon.