Forums

Something went wrong :-( when loading a new web app on python anywhere

I uploaded my Django app on python anywhere but it is not loading. Getting this on screen.

Something went wrong :-(

This website is hosted by PythonAnywhere, an online hosting environment. Something went wrong while trying to load it; please try again later.

If this is your PythonAnywhere-hosted site, there may be a bug in your code. Check your site's server and error logs for any messages — you can view them from the Web tab inside PythonAnywhere.

You'll find a series of tips on how to debug problems, and solutions to common issues on our Help pages

If you get completely stuck, then drop us a line at support@pythonanywhere.com, in the forums, or using the "Send feedback" link on the site, quoting the error code below.

Error code: Unhandled Exception

This is what my wsgi file looks like.

activate_this_path = '/home/amritha/.virtualenvs/costtool/bin/activate_this.py' with open(activate_this_path) as f: code = compile(f.read(), activate_this_path, 'exec') exec(code, dict(file=activate_this_path))

import os import sys

path = '/home/amritha/costtool' if path not in sys.path: sys.path.append(path)

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

import django.core.handlers.wsgi application = django.core.handlers.wsgi.WSGIHandler()

Can somebody help me out?

Hi amritha,

I would encourage you to take a look at the error log as shown here.

If you could look at the error message is there, you might be able to find your problem. Otherwise maybe you could post your error log here and we could take a look at it together?

Hi Conrad, First few lines of my error log 2

014-12-03 16:31:01,514 :Traceback (most recent call last):
2014-12-03 16:31:01,514 :  File "/bin/user_wsgi_wrapper.py", line 130, in __call__
2014-12-03 16:31:01,515 :    self.error_log_file.logger.exception("Error running WSGI application")
2014-12-03 16:31:01,515 :  File "/usr/lib/python3.4/logging/__init__.py", line 1296, in exception
2014-12-03 16:31:01,531 :    self.error(msg, *args, **kwargs)
2014-12-03 16:31:01,532 :  File "/usr/lib/python3.4/logging/__init__.py", line 1289, in error
2014-12-03 16:31:01,532 :    self._log(ERROR, msg, args, **kwargs)
2014-12-03 16:31:01,532 :  File "/usr/lib/python3.4/logging/__init__.py", line 1395, in _log
2014-12-03 16:31:01,533 :    self.handle(record)
2014-12-03 16:31:01,533 :  File "/usr/lib/python3.4/logging/__init__.py", line 1404, in handle
2014-12-03 16:31:01,533 :    if (not self.disabled) and self.filter(record):
2014-12-03 16:31:01,533 :  File "/usr/lib/python3.4/logging/__init__.py", line 692, in filter
2014-12-03 16:31:01,534 :    for f in self.filters:
2014-12-03 16:31:01,534 :  File "/bin/user_wsgi_wrapper.py", line 122, in __call__
2014-12-03 16:31:01,534 :    app_iterator = self.app(environ, start_response)
2014-12-03 16:31:01,534 :  File "/bin/user_wsgi_wrapper.py", line 136, in import_error_application
2014-12-03 16:31:01,534 :    raise e
2014-12-03 16:31:01,534 :  File "/bin/user_wsgi_wrapper.py", line 145, in <module>
2014-12-03 16:31:01,535 :    application = load_wsgi_application()
2014-12-03 16:31:01,535 :  File "/bin/user_wsgi_wrapper.py", line 141, in load_wsgi_application
2014-12-03 16:31:01,535 :    return __import__(os.environ['WSGI_MODULE'], globals(), locals(), ['application']).application
2014-12-03 16:31:01,535 :  File "/var/www/amritha_pythonanywhere_com_wsgi.py", line 18, in <module>
2014-12-03 16:31:01,537 :    with open(activate_this_path) as f:
2014-12-03 16:31:01,538 :FileNotFoundError: [Errno 2] No such file or directory: '/home/amritha/costtool/bin/activate_this.py'

This is what I have in my wsgi.py file. As you can see, the activate_this.py file is in a different location from what is given in the error log.

activate_this_path = '/home/amritha/.virtualenvs/costtool/bin/activate_this.py'
with open(activate_this_path) as f:
    code = compile(f.read(), activate_this_path, 'exec')
exec(code, dict(__file__=activate_this_path))

#DJANGO

import os
import sys
#
## assuming your django settings file is at '/home/amritha/mysite/settings.py'
path = '/home/amritha/costtool'
if path not in sys.path:
    sys.path.append(path)

os.environ['DJANGO_SETTINGS_MODULE'] = 'costtool.settings'
#
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

[edit by admin: formatting]

To clarify, the logs you were looking at are chronological, so the most recent stuff is on the bottom. You were looking at errors from a day ago- which I think you have fixed already.

Hello , I am having the same problem while loading my site first time

By the same problem do you mean that you have "No such file or directory: '/home/amritha/costtool/bin/activate_this.py'" in your web app error log?

Hello everyone, I also have the same problems when upload my web project to PythonAnywhere. The page shows like "This website is hosted by PythonAnywhere, an online hosting environment. Something went wrong while trying to load it; please try again later.

If this is your PythonAnywhere-hosted site, there may be a bug in your code. Check your site's server and error logs for any messages — you can view them from the Web tab inside PythonAnywhere."

Check your site's server and error logs for any messages — you can view them from the Web tab inside PythonAnywhere. There will be tracebacks there that you can use to debug your code.

.

2022-03-23 05:56:58,084: Error running WSGI application
2022-03-23 05:56:58,084: ModuleNotFoundError: No module named 'django'
2022-03-23 05:56:58,085:   File "/var/www/anuragtiwari7838_pythonanywhere_com_wsgi.py", line 14, in <module>
2022-03-23 05:56:58,085:     from django.core.wsgi import get_wsgi_application
2022-03-23 05:56:58,085: ***************************************************
2022-03-23 05:56:58,085: If you're seeing an import error and don't know why,
2022-03-23 05:56:58,085: we have a dedicated help page to help you debug: 
2022-03-23 05:56:58,086: https://help.pythonanywhere.com/pages/DebuggingImportError/
2022-03-23 05:56:58,086: ***************************************************

This error is showing in my error log even after included from django.core.wsgi import get_wsgi_application in my file

Are you using a virtual environment for your web app? Make sure that Django is installed in it.

Something went wrong :-(

Something went wrong while trying to load this website; please try again later.

If it is your site, you should check your logs to determine what the problem is.

where is the problem here? why does it keep appearing like this

Check your error and server logs for tracebacks that you can use to debug the error.

Something went wrong :-( Something went wrong while trying to load this website; please try again later.

If it is your site, you should check your logs to determine what the problem is.

There was an error loading your PythonAnywhere-hosted site. There may be a bug in your code.

Error code: Unhandled Exception Debugging tips The first place to look is at your web app page to ensure that there are no errors indicated there. Next, check your site's server and error logs for any messages — you can view them here: msulthana.pythonanywhere.com.error.log msulthana.pythonanywhere.com.server.log You can find helpful tips on the PythonAnywhere help site: There's an ImportError in the logs "403 Forbidden" error or "Connection Refused" error in logs Database connection errors There are many more helpful guides on our Help pages If you get completely stuck, then drop us a line at PythonAnywhere Support liveusercare@pythonanywhere.com, in the forums, or using the "Send feedback" link on the site, with the relevant lines from your logs.

Have you taken a look at your error logs? If so, what did you see there? The most recent error will be at the bottom of the log file.