-
Notifications
You must be signed in to change notification settings - Fork 1
Deploy on PythonAnywhere
IMPORTANT: this guide will help you deploy an instance of PeARS-lite on pythonanywhere. Please be aware that depending on your jurisdiction, the public display of snippets may or may not be legal. Inform yourself before making your instance public. The PeARS project declines all responsibility for the public use of its software.
- Clone the repository in your pythonanywhere space:
git clone https://github.com/PeARSearch/PeARS-lite.git
- Create a virtualenv and install requirements:
mkvirtualenv --python=/usr/bin/python3.9 PeARS-lite
cd PeARS-lite
workon PeARS-lite
pip install -r requirements.txt
-
Go the Web App tab and select 'add a new Web app' and follow instructions. If you already have a Web app running, you may need to use a subdomain to host your app, e.g. pearslite-.pythonanywhere.com. Select 'manual configuration' and python3.9 as options.
-
Enter the path to your web app source code. If you installed PeARS-lite in your home directory, it will be something like */home//PeARS-lite/.
-
Edit your wsgi file. It should be something like:
import sys
path = '/home/<your username>/PeARS-lite/'
if path not in sys.path:
sys.path.append(path)
from app import app as application
-
A couple of changes will be needed to your app/__init__.py file, to make your paths compatible with the PythonAnywhere setup. We provide an alternative app/__init__.py template which you can use for your own purposes, under app/__init_for_pythonanywhere__.py. You should copy its content into the original app/__init__.py and make sure to replace all instances of <your_username> with your Python Anywhere username. (Also check the paths, in case you did not install PeARS-lite in your home directory.)
-
Under 'Virtualenvs', link to your virtualenv. The path should be similar to /home/<your_username>/.virtualenvs/PeARS-lite if you used the mkvirtualenv method we showed above.
-
Edit the section 'Static files'. You should add a URL /static/ and link it to your static directory, which will be something like /home/<your_username>/PeARS-lite/app/static/.
-
We recommend to force https for your app by activating the relevant option at the bottom of the Web app page.