Deploy a Flask web app on PythonAnywhere

If you have a working Flask app that you can run on localhost on your computer, you can easily make it public by deploying it on PythonAnywhere.

It takes a couple of minutes to deploy. Here are the steps how to do it:

  • Make sure you have signed up for a free PythonAnywhere account, and you’re logged in.
  • Go to the Web menu item and then press the Add new web app button.
  • Click Next, then click on Flask and click on the latest version of Python that you see there. Then click Next again to accept the project path.

That’s it. You can visit your web app on (change username with your actual PythonAnywhere username). That’s the URL of your app. You will see something like  “Hello from Flask” there. If you want to upload your project, please follow the next steps:

  1. In the Code section of the Web menu page click on Go to Directory next to Source Code.
  2. Delete the file.
  3. In your local computer, rename your main Python file to PythonAnywhere will be looking for such a file name.
  4. Use the Upload a file button to upload your Python file.
  5. If you have html, css and other project files, you can create a template and a static directory in the Directories section and upload your files there.
  6. Go to the Web menu page and click on the Reload button.

Now, your Flask app should be app and running on On the free plan you have 500 MB of disk space, so if your project gets bigger you may want to upgrade to one of the PythonAnywhere paid plans.

Next Lecture
Recommended Course

Python Mega Course: Learn Python in 60 Days, Build 20 Apps
Learn Python on Udemy completely in 60 days or less by building 20 real-world applications from web development to data science.