1

I want to deploy my flask app publicly using pythonanywhere. I have followed all steps exactly. Tried implementing it with virtualenv and without virtualenv but none works.

I can get the simple flask page 'Hello to flask app" working but my code is not working.

Path is /home/anwaraliafshan/bella and file is afshan.py

This is my WSGI.py and I tried replacing flask with bella and afshan but nothing worked. Also getting import imutil error in error.log though install imutil successfully on python3 Please help me finding the cause. Thanks in advance

# This file contains the WSGI configuration required to serve up your
# web application at http://<your-username>.pythonanywhere.com/
# It works by setting the variable 'application' to a WSGI handler of some
# description.
#
# The below has been auto-generated for your Flask project

import sys

# add your project directory to the sys.path
project_home = '/home/anwaraliafshan/bella/'
if project_home not in sys.path:
    sys.path = [project_home] + sys.path

# import flask app but need to call it "application" for WSGI to work
from flask import app as application  # noqa
2
  • You can follow this link full solutions . sys.path is wrong defined by you (see examples in tutorial) Commented Dec 20, 2018 at 11:35
  • Don't call your file flask.py. Rename it to something else, because flask right now could be referring to both the module and the app. Commented Dec 20, 2018 at 13:23

1 Answer 1

4

As quoted from their website:

import sys
path = '/home/yourusername/mysite'
if path not in sys.path:
   sys.path.insert(0, path)

from flask_app import app as application
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.