Skip to main content

Uploading a Django Project to PythonAnywhere

You just configured your project so that it is suitable to run in production. Now you need to upload the entire tree of the myproject directory to PythonAnywhere. Go to the Files menu in the upper right corner of the screen. On the left you will see something like this:

PythonAnywhere Directories

We are interested in the myproject folder, where the code of the default applications generated by PythonAnywhere lies. We are going to delete that folder, since the next step will be to upload our own myproject folder from our development environment (= our own computer.)

PythonAnywhere Delete Directory

Since it is not possible to upload a folder through the browser, you must compress your project folder in a ZIP file. We suggest doing it by compressing the top-level myproject folder to avoid problems later:

Compressing a Django project

note

7-Zip is an excellent free and cross-platform program for compressing and decompressing ZIP files.

Back on the PythonAnywhere site, press the orange Upload a file button and select myproject.zip:

Upload Django project to PythonAnywhere

It remains to unzip the file in PythonAnywhere. Click the Open Bash console here button, which will open a remote terminal.

Open Bash Console in PythonAnywhere

Once the terminal has loaded, write the following command:

unzip myproject.zip

It will quickly extract all the contents of the file. Once finished, close the terminal by pressing CTRL + D.

That's it! You have already uploaded the code of your project. Finally, you need to make PythonAnywhere reload the code of running application. Go back to the Web tab and press the Reload <username>.pythonanywhere.com button:

Reload app in PythonAnywhere

Visit <username>.pythonanywhere.com in your browser and voilá!

Congratulations! You have deployed your first Django application.