Midgard
d0699b3716
Require double space before tags and price, like in the plain text accounting format of ledger. This makes it easier to differentiate between prices mentioned in descriptions and the price for the dish. |
||
---|---|---|
app | ||
etc | ||
.editorconfig | ||
.gitignore | ||
.pylintrc | ||
.python-version | ||
first-setup.sh | ||
LICENSE | ||
parse_hlds.sh | ||
populate-db.sh | ||
README.md | ||
requirements.in | ||
requirements.txt | ||
tests.md |
Haldis
Haldis is your friendly neighbourhood servant. He exists so lazy fucks like you and me don't need to keep tabs of who is ordering what from where. Start an order and let people add items with a simple mouse-click! No more calculating prices and making lists! Be lazier today!
Local setup
There is a special script to get started with the project. Just run it in the root of the project.
./first-setup.sh
This will create a virtual environment, install the necessary dependencies and will give you the option to seed the database.
If you are using a database other then sqlite you will first need to configure the correct URI to the database in the generated 'config.py' file. Afterwards upgrade the database to the latest version using
cd app
python3 app.py db upgrade
You can now still seed the database by running
./populate-db.sh
in the root folder of the project.
Activate the virtual environment using
source venv/bin/activate
Finally run the webserver with
python3 app/app.py runserver
Make sure to use localhost instead of 127.0.0.1 if you want to be able to login.
Development
Changing the database
- Update models located in 'app/models.py'
- Run
python app/app.py db migrate
to create a new migration. - Apply the changes to the database using
python app/app.py db upgrade
Adding dependencies/libraries
- Add new dependency to the
requirements.in
file - Run
pip-compile
to freeze the dependency into therequirements.txt
file together with its own deps - Run
pip-sync
to download frozen deps
Updating dependencies
Run pip-compile --upgrade
For more information about managing the dependencies see jazzband/pip-tools: A set of tools to keep your pinned Python dependencies fresh.
Production
To prepare the application in a production environment, follow the same steps as for Local setup up to and including ./populate-db.sh
.
Set DEBUG to False in app/config.py
.
See Flask's deployment documentation.
Set the server's Python interpreter to /path/to/haldis/venv/bin/python
. Doing source venv/bin/activate
is not necessary when that binary is used.