PythonAnywhere is an online integrated development environment and web hosting service based on the Python programming language.
You can host your pet projects here which is free.
- Go to PythonAnywhere
- Create account and login
- Go to consoles
- Select bash console
- Create virtual environment for python
mkvirtualenv --python=python3.8 envname
- Your environment will be activated and in bash you will see the envname in parenthesis
- Install django
pip install -U django==3.0.3
- check django path
- install necessary packages
pip instal xyz
- Clone git repo
git clone repo.git
Note : You should have a git repo of the project or web application
- Go to dashboard of pythonanywhere.com and go to Web
- Select create new web app
- select manual configuration
- next next done !
- Here you will see the url for your project click and you will see hello world page which is default for python
setvirtualenvpath which you will find in console using
/static/as your project static folder path as mine is
Edit WSGI configuration file as the file given below
import os import sys ## assuming your django settings file is at '/home/jspw/mysite/mysite/settings.py' ## and your manage.py is is at '/home/jspw/mysite/manage.py' path = '/home/jspw/mysite' #path of your project if path not in sys.path: sys.path.append(path) os.chdir(path) os.environ.setdefault('DJANGO_SETTINGS_MODULE', "food_menu_project.settings") #projectname.settings import django django.setup() from django.core.wsgi import get_wsgi_application application = get_wsgi_application()
- Done ! Clik on the reload in the webapp page then go to the website url and boom!!!
Note : Check settings.py file and you have allowed your host url.