Forums

Its shows Hello World page after running

Hey,

When I did all the configurations, reload the app then it shows http://jasneet.pythonanywhere.com/ mention link data.. basically showing the default page HELLO WORLD on this link.. Please guide me where to start my actual django project instead of this default page...

When I visit that site, I get a "Something went wrong" error page. If you look at the "Web" page, in the "Virtualenv" section, you'll see an error: "This virtualenv seems to have the wrong Python version (2.7 instead of 3.5).". You should delete the virtualenv you currently have, and create a new one using the same version of Python as you have specified for your website on the "Web" page, which is 3.5. The way to specify the Python version with the mkvirtualenv command is this:

mkvirtualenv virenv --python=python3.5

Thanks for response.... :)

Please tell me that my whole code is on Python 2.7 version will it effect on code running.. coz there is alot changes in new version of python

LINK: https://jasneet.pythonanywhere.com/

Now its showing this error

If you're seeing an import error and don't know why,
2018-11-14 13:24:10,135: we have a dedicated help page to help you debug: 
2018-11-14 13:24:10,135: https://help.pythonanywhere.com/pages/DebuggingImportError/
2018-11-14 13:24:10,136: ***************************************************
2018-11-14 13:25:56,547: Error running WSGI application
2018-11-14 13:25:56,553: ImportError: No module named 'django.core.urlresolvers'
2018-11-14 13:25:56,553:   File "/var/www/jasneet_pythonanywhere_com_wsgi.py", line 89, in <module>
2018-11-14 13:25:56,554:     application = get_wsgi_application()
2018-11-14 13:25:56,554: 
2018-11-14 13:25:56,554:   File "/usr/lib/python3.5/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
2018-11-14 13:25:56,554:     django.setup(set_prefix=False)
2018-11-14 13:25:56,554: 
2018-11-14 13:25:56,554:   File "/usr/lib/python3.5/site-packages/django/__init__.py", line 24, in setup
2018-11-14 13:25:56,555:     apps.populate(settings.INSTALLED_APPS)
2018-11-14 13:25:56,555: 
2018-11-14 13:25:56,555:   File "/usr/lib/python3.5/site-packages/django/apps/registry.py", line 112, in populate
2018-11-14 13:25:56,555:     app_config.import_models()
2018-11-14 13:25:56,556: 
2018-11-14 13:25:56,556:   File "/usr/lib/python3.5/site-packages/django/apps/config.py", line 198, in import_models
2018-11-14 13:25:56,556:     self.models_module = import_module(models_module_name)
2018-11-14 13:25:56,556: 
2018-11-14 13:25:56,556:   File "/home/Jasneet/pms-eknous/pharma_master/models.py", line 6, in <module>
2018-11-14 13:25:56,557:     from django.core.urlresolvers import reverse
2018-11-14 13:25:56,557: ***************************************************
2018-11-14 13:25:56,557: If you're seeing an import error and don't know why,
2018-11-14 13:25:56,557: we have a dedicated help page to help you debug: 
2018-11-14 13:25:56,558: https://help.pythonanywhere.com/pages/DebuggingImportError/
2018-11-14 13:25:56,558: ***************************************************

[edit by admin: formatting]

If your code is for Python 2.7, you can change the website so that it uses that Python version -- just click the pencil icon next to the version on the "Web" page in the "Code" section.

Now two different thing happens in the code.. if i change the python version as u mentioned then its gives the same error as this... :

2018-11-14 14:46:34,564: ***************************************************
2018-11-15 06:16:03,682: Error running WSGI application
2018-11-15 06:16:03,688: InvalidClientSecretsError: ('Error opening file', 'client_secret.json', 'No such file or directory', 2)
2018-11-15 06:16:03,688:   File "/var/www/jasneet_pythonanywhere_com_wsgi.py", line 89, in <module>
2018-11-15 06:16:03,688:     application = get_wsgi_application()
2018-11-15 06:16:03,688: 
2018-11-15 06:16:03,689:   File "/usr/local/lib/python2.7/dist-packages/django/core/wsgi.py", line 13, in get_wsgi_application
2018-11-15 06:16:03,689:     django.setup(set_prefix=False)
2018-11-15 06:16:03,689: 
2018-11-15 06:16:03,689:   File "/usr/local/lib/python2.7/dist-packages/django/__init__.py", line 27, in setup
2018-11-15 06:16:03,689:     apps.populate(settings.INSTALLED_APPS)
2018-11-15 06:16:03,689: 
2018-11-15 06:16:03,689:   File "/usr/local/lib/python2.7/dist-packages/django/apps/registry.py", line 108, in populate
2018-11-15 06:16:03,689:     app_config.import_models()
2018-11-15 06:16:03,689: 
2018-11-15 06:16:03,689:   File "/usr/local/lib/python2.7/dist-packages/django/apps/config.py", line 202, in import_models
2018-11-15 06:16:03,690:     self.models_module = import_module(models_module_name)
2018-11-15 06:16:03,690: 
2018-11-15 06:16:03,690:   File "/home/Jasneet/pms-eknous/pharma_master/models.py", line 12, in <module>
2018-11-15 06:16:03,690:     from oauth2client.contrib.django_util.models import CredentialsField
2018-11-15 06:16:03,690: 
2018-11-15 06:16:03,690:   File "/usr/local/lib/python2.7/dist-packages/oauth2client/contrib/django_util/__init__.py", line 365, in <module>
2018-11-15 06:16:03,690:     oauth2_settings = OAuth2Settings(django.conf.settings)
2018-11-15 06:16:03,690: 
2018-11-15 06:16:03,690:   File "/usr/local/lib/python2.7/dist-packages/oauth2client/contrib/django_util/__init__.py", line 341, in __init__
2018-11-15 06:16:03,690:     info = _get_oauth2_client_id_and_secret(settings_instance)
2018-11-15 06:16:03,691: 
2018-11-15 06:16:03,691:   File "/usr/local/lib/python2.7/dist-packages/oauth2client/contrib/django_util/__init__.py", line 277, in _get_oauth2_client_id_and_secret
2018-11-15 06:16:03,691:     return _load_client_secrets(secret_json)
2018-11-15 06:16:03,691: 
2018-11-15 06:16:03,691:   File "/usr/local/lib/python2.7/dist-packages/oauth2client/contrib/django_util/__init__.py", line 255, in _load_client_secrets
2018-11-15 06:16:03,691:     client_type, client_info = clientsecrets.loadfile(filename)
2018-11-15 06:16:03,691: 
2018-11-15 06:16:03,691:   File "/usr/local/lib/python2.7/dist-packages/oauth2client/clientsecrets.py", line 165, in loadfile
2018-11-15 06:16:03,691:     return _loadfile(filename)
2018-11-15 06:16:03,691: 
2018-11-15 06:16:03,692:   File "/usr/local/lib/python2.7/dist-packages/oauth2client/clientsecrets.py", line 125, in _loadfile
2018-11-15 06:16:03,692:     exc.strerror, exc.errno)
2018-11-15 06:16:03,692: ***************************************************
2018-11-15 06:16:03,692: If you're seeing an import error and don't know why,
2018-11-15 06:16:03,692: we have a dedicated help page to help you debug: 
2018-11-15 06:16:03,692: https://help.pythonanywhere.com/pages/DebuggingImportError/
2018-11-15 06:16:03,692: ***************************************************

secondly if i comment this

# then:
# from django.core.wsgi import get_wsgi_application
# application = get_wsgi_application()

then i shows the hello world page...

please brief me where i m wrong...

[edit by admin: formatting]

It shows the hello world page in the second case because you've commented out the code that loads your own website.

The first error is because you're trying to load a file called client_secret.json. When you specify a relative path like that (without a directory name) then it will try to load the file from the current working directory of the website, which is probably not what you want. If you use a full path to the file (for example /home/Jasneet/something/client_secret.json) then it will be able to find the file, which will fix this problem.