Forums

wsgi applicatioin returning a name error

Hi there am trying to deploy my first django web app/blog. Am new to django so any assistance is highly appreciated. i done everything as far i understand. When i edited the wsgi file to finally go online, it keeps bringing back the same name error: This is wsgi file i edited:

`username_pythonanywhere_com_wsgi.py

my username = username

myenviroment var = myvenv

import os import sys

path = 'home/username/myvenv/my-first-blog/mysite' 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 django.contrib.staticfiles.handlers import StaticFilesHandler application = StaticFilesHandler(get_wsgi_application())`

then its returning this error message all the time:

2017-01-23 11:25:33,613 :Error running WSGI application

2017-01-23 11:25:33,615 :NameError: name 'username_pythonanywhere_com_wsgi' is not defined 2017-01-23 11:25:33,615 : File "/var/www

at this point i have stepped into my Ahha moments...so i cant actually seem to point out what's next. Any help is well appreciated. Thank you in advance.

the path probably needs to start with a slash- /home/ instead of home/.

Also maybe you are having a syntax error in your wsgi.py file- try running it by itself to see if it runs correctly.

yeah i have taken everything off...will probably have to start from scratch i guess....

@bfg hi man thanks man....youhave answered my question. That was the case. Pythons casesensitivity got me...like you said...i missed the first slash so the virtualenv was being search in the wrong place that was what prompted the name error thing. Now i have it up and running...Cheers man