|
1 year ago | |
---|---|---|
.vscode | 1 year ago | |
app | 1 year ago | |
tests | 1 year ago | |
.gitignore | 2 years ago | |
README.md | 1 year ago | |
conf.wsgi | 1 year ago | |
config-example.py | 1 year ago | |
conftest.py | 1 year ago | |
dev_data.sqlite3 | 1 year ago | |
myapp.py | 1 year ago | |
requirements.txt | 1 year ago |
Prerequisites Python3 and Pip (install guide), virtualenv (install guide), and git (another install guide).
Clone the repository
Navigate to the repository's top level (the level with ‘README.md’, ‘requirements.txt’, the folder ‘app’, etc)
Create a virtual environment with python 3 and enter it (guide here)
Install the required python packages from requirements.txt (guide here)
Create a copy of ‘config-example.py’ in the same directory called ‘config.py’ and fill it in with your secrets. ‘config.py’ already has an entry in ‘.gitignore’
Set the Flask environment variables
Unix:
export FLASK_ENV=development
export FLASK_APP=myapp
Windows CMD:
set FLASK_ENV=development
set FLASK_APP=myapp
Windows PowerShell:
$env:FLASK_ENV='development'
$env:FLASK_APP='myapp.py'
flask run
Put it in /app/init.py
Install Apache
Install the appropriate version of mod_wsgi for your distribution and version of Python.
Download this project and set it up based on the instructions in the previous section, Setting up the development environment
Add an Apache virtual host with the following details
WSGIDaemonProcess fugue python-home=[PATH_TO_VIRTUALENV] home=[PATH_TO_PROJECT_HOME]
WSGIApplicationGroup %{GLOBAL}
WSGIScriptAlias /[PATH] [PATH_TO_CONF_WSGI]
<Directory [PATH_TO_PROJECT_HOME]>
WSGIProcessGroup [PROCESS_GROUP_NAME]
Options FollowSymLinks
AllowOverride None
Require all granted
</Directory>
Example variable values are as follows:
Restart Apache and see if it works!
Tweak your project's home directory permissions if Apache can't access it.
Tests can be run from the root directory with the command
pytest