- First, install the
pipenvpackage, by using this command in the terminal:
pip install pipenv
- Then, we use
pipenvto read the contents of the Pipfile and install all the necessary packages that make the frontend work. This can be accompished with:
pipenv install(Make sure the terminal is opened within the correct folder!)
- Initialize the database:
pipenv run python progcomp/scripts/initialize_db.py
- Run the server with:
pipenv run flask --app progcomp --debug runThe site will then be running locally at localhost:5000, and you can access it as a url in your preferred web browser.
You can stop it at any time by pressing CTRL+C in the terminal.
Once the server is running, you control it by using the admin panel, found at localhost:5000/admin. The password used is set using environment variables.
Read .env.example for an example for an .env file.
Create a .env file:
- SECRET_KEY can be anything; just used to sign the Flask stuff
- ADMIN_KEY_HASH should be the hashed version of the password you've chosen
To get the hashed version of your password:
- Load the venv with
pipenv shell - Run
pythonto access the python interactive environment - Run
import werkzeug - Run
print(werkzeug.security.generate_password_hash("your_password")) - Copy the output to
ADMIN_KEY_HASH
- SQL-Alchemy makes editing the data while live very easy, write your queries following the template and you can do a lot
- Alembic is used for DB versioning, if you want to add or remove fields (don't remove while live)