Forums

Error running WSGI application NameError name is not defined

Error running WSGI application NameError: name 'ramonyaskal' is not defined. How can i fix it, it seems everything is done correctly. I can not understand. Help...

/var/www/ramonyaskal_pythonanywhere_com_wsgi.py import os import sys

path = '/home/ramonyaskal/Q2'  # use your own username here
if path not in sys.path:
    sys.path.append(path)

os.environ['DJANGO_SETTINGS_MODULE'] = 'Blogs.settings'

from django.core.wsgi import get_wsgi_application
from whitenoise.django import DjangoWhiteNoise
application = DjangoWhiteNoise(get_wsgi_application())

/home/ramonyaskal/Q2/Blogs/settings.py

ALLOWED_HOSTS = [ramonyaskal.pythonanywhere.com]

Debug:

(myvenv) 20:36 ~/Q2 (master)$ python -i /var/www/ramonyaskal_pythonanywhere_com_wsgi.py
Traceback (most recent call last):
  File "/var/www/ramonyaskal_pythonanywhere_com_wsgi.py", line 12, in <module>
    application = DjangoWhiteNoise(get_wsgi_application())
  File "/home/ramonyaskal/Q2/myvenv/lib/python3.6/site-packages/django/core/wsgi.py", line 13, in get_wsgi_application
    django.setup(set_prefix=False)
  File "/home/ramonyaskal/Q2/myvenv/lib/python3.6/site-packages/django/__init__.py", line 22, in setup
    configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
  File "/home/ramonyaskal/Q2/myvenv/lib/python3.6/site-packages/django/conf/__init__.py", line 56, in __getattr__
    self._setup(name)
  File "/home/ramonyaskal/Q2/myvenv/lib/python3.6/site-packages/django/conf/__init__.py", line 41, in _setup
    self._wrapped = Settings(settings_module)
  File "/home/ramonyaskal/Q2/myvenv/lib/python3.6/site-packages/django/conf/__init__.py", line 110, in __init__
    mod = importlib.import_module(self.SETTINGS_MODULE)
  File "/home/ramonyaskal/Q2/myvenv/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 978, in _gcd_import
  File "<frozen importlib._bootstrap>", line 961, in _find_and_load
  File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
  File "/home/ramonyaskal/Q2/Blogs/settings.py", line 43, in <module>
    ALLOWED_HOSTS = [ramonyaskal.pythonanywhere.com]
NameError: name 'ramonyaskal' is not defined
>>>

Log:

2017-07-07 20:44:45,206: Error running WSGI application
2017-07-07 20:44:45,207: NameError: name 'ramonyaskal' is not defined
2017-07-07 20:44:45,207:   File "/var/www/ramonyaskal_pythonanywhere_com_wsgi.py", line 12, in <module>
2017-07-07 20:44:45,207:     application = DjangoWhiteNoise(get_wsgi_application())
2017-07-07 20:44:45,208: 
2017-07-07 20:44:45,208:   File "/home/ramonyaskal/Q2/myvenv/lib/python3.6/site-packages/django/core/wsgi.py", line 13, in get_wsgi_application
2017-07-07 20:44:45,208:     django.setup(set_prefix=False)
2017-07-07 20:44:45,208: 
2017-07-07 20:44:45,208:   File "/home/ramonyaskal/Q2/myvenv/lib/python3.6/site-packages/django/__init__.py", line 22, in setup
2017-07-07 20:44:45,209:     configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
2017-07-07 20:44:45,209: 
2017-07-07 20:44:45,209:   File "/home/ramonyaskal/Q2/myvenv/lib/python3.6/site-packages/django/conf/__init__.py", line 56, in __getattr__
2017-07-07 20:44:45,209:     self._setup(name)
2017-07-07 20:44:45,209: 
2017-07-07 20:44:45,209:   File "/home/ramonyaskal/Q2/myvenv/lib/python3.6/site-packages/django/conf/__init__.py", line 41, in _setup
2017-07-07 20:44:45,210:     self._wrapped = Settings(settings_module)
2017-07-07 20:44:45,210: 
2017-07-07 20:44:45,210:   File "/home/ramonyaskal/Q2/myvenv/lib/python3.6/site-packages/django/conf/__init__.py", line 110, in __init__
2017-07-07 20:44:45,210:     mod = importlib.import_module(self.SETTINGS_MODULE)
2017-07-07 20:44:45,210: 
2017-07-07 20:44:45,210:   File "./Blogs/settings.py", line 43, in <module>
2017-07-07 20:44:45,210:     ALLOWED_HOSTS = [ramonyaskal.pythonanywhere.com]

aaaaah....sory ... ALLOWED_HOSTS = ['ramonyaskal.pythonanywhere.com'] Missed quotes 'ramonyaskal.pythonanywhere.com'