Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Steps To Deploy Django App on Pythonanywhere

1) Upload Project folder on pythonanywhere with either of the below steps:

Convert Project Folder into Zip Folder

Go to Files section and upload the compressed folder

or

Go to Console and Open Bash

Copy repository of same available on Github using Git Clone command

2) Go to Console and Open Bash

3) Create Virtual Environment using command=>

"$ mkvirtualenv --python=/usr/bin/python3.8 mysite-venv"

4) Unzip project folder "unzip project_name.zip"

5) Cd into project_folder

6) Use 'pip install -r requirements.txt' to install all dependencies in Bash(Ensure


requirement.txt file is there in uploaded project folder)

7) Go to Web section

8) Click on add new web app

......select manual configuration

.....select proper python version

New Fields on the Web page will get displayed which are to be filled...

.......go to WSGI configuration file to change configuration (as per point 9)

........Add Source code path

....... Add Virtual Environment Path

9) Note: incase of WSGI configuration file...Keep the code related to django ....delete rest
of the code...uncomment the code for Django..

change the term "mysite" with the name of the project folder(2 places)

10) Add STATIC_ROOT and MEDIA_ROOT in settings.py file and add their paths on fields
mentioned on WEB page( project related files can be accessed and edited by clicking on
them in the file page)

11) Run "python manage.py collectstatic" in Bash

12) Go to Databases Page


Select Mysql or postgres..as per requirement..

.. enter password

.. initialize

.. Enter database name

.. note down host name

Make changes in settings.py file in its database section

13) Run 'python manage.py makemigrations' in Bash and then

'python manage.py migrate'

14) Run 'python manage.py createsuperuser' in Bash

Reload app..(Don't forget to reload app anytime some changes are made)

15) Enable HTTPS in WEB Section

16)Reload app again

17) If website is working properly change the debug settings to False and add domain names
in alowed_hosts list in settings.py file.

18) Reload app again

You might also like