Merge pull request #103 from ZeusWPI/fix_deps
Update all dependencies, update first-setup script, add how-to-run docs. Badges are nice to
This commit is contained in:
commit
dfe04a885d
5 changed files with 127 additions and 44 deletions
65
README.md
65
README.md
|
@ -1,21 +1,62 @@
|
||||||
Haldis
|
Haldis
|
||||||
=======
|
=======
|
||||||
|
[![chat mattermost](https://img.shields.io/badge/chat-mattermost-blue.svg)](https://mattermost.zeus.gent/zeus/channels/haldis)
|
||||||
|
![Website](https://img.shields.io/website/https/haldis.zeus.gent.svg)
|
||||||
|
![Mozilla HTTP Observatory Grade](https://img.shields.io/mozilla-observatory/grade-score/haldis.zeus.gent.svg?publish)
|
||||||
|
|
||||||
|
![GitHub last commit](https://img.shields.io/github/last-commit/zeuswpi/haldis.svg)
|
||||||
|
![GitHub issues](https://img.shields.io/github/issues/zeuswpi/haldis.svg)
|
||||||
|
![GitHub pull requests](https://img.shields.io/github/issues-pr/zeuswpi/haldis.svg)
|
||||||
|
![GitHub commit activity](https://img.shields.io/github/commit-activity/y/zeuswpi/haldis.svg)
|
||||||
|
|
||||||
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.
|
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!
|
Start an order and let people add items with a simple mouse-click!
|
||||||
No more calculating prices and making lists!
|
No more calculating prices and making lists!
|
||||||
Be lazier today!
|
Be lazier today!
|
||||||
|
|
||||||
Local hosting steps
|
## Local setup
|
||||||
===================
|
|
||||||
0. This is a Python 3 project so make sure to use python 3 and pip3 everywhere
|
|
||||||
1. Run `pip install -r requirements.txt`
|
|
||||||
2. `cd app`
|
|
||||||
3. Copy `config.example.py` to `config.py`
|
|
||||||
4. Copy the python files from `database/` to `app/` (yes, it's sad, I know)
|
|
||||||
5. Run `python create_database.py` in `app/` (if you want to fill the DB with sample data be sure to answer `Y` to `Do you still want to add something?`)
|
|
||||||
6. Run `rm -f add_* create_database.py*` in `app/`
|
|
||||||
7. Run `python haldis.py runserver`
|
|
||||||
|
|
||||||
---
|
There is a special script to get started with the project. Just run it in the root of the project.
|
||||||
Or run `./first-setup.sh` in the root of the git folder (in linux)
|
|
||||||
|
./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
|
||||||
|
|
||||||
|
python app/haldis.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
|
||||||
|
|
||||||
|
python app/haldis.py runserver
|
||||||
|
|
||||||
|
## Development
|
||||||
|
|
||||||
|
### Changing the database
|
||||||
|
|
||||||
|
1. Update models located in 'app/models.py'
|
||||||
|
2. Run `python app/haldis.py db migrate` to create a new migration.
|
||||||
|
3. Apply the changes to the database using `python app/haldis.py db upgrade`
|
||||||
|
|
||||||
|
### Adding dependencies/libraries
|
||||||
|
|
||||||
|
1. Add new dependency to the `requirements.in` file
|
||||||
|
2. Run `pip-compile` to freeze the dependency into the `requirements.txt` file together with it's own deps
|
||||||
|
3. 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.](https://github.com/jazzband/pip-tools)
|
||||||
|
|
|
@ -2,15 +2,31 @@
|
||||||
# A simple file to run all instructions from the README
|
# A simple file to run all instructions from the README
|
||||||
## this should be run in the root of the repository
|
## this should be run in the root of the repository
|
||||||
|
|
||||||
if [ ! -d "vent" ]; then
|
bold=$(tput bold)
|
||||||
|
normal=$(tput sgr0)
|
||||||
|
|
||||||
|
B="\n${bold}"
|
||||||
|
E="${normal}"
|
||||||
|
|
||||||
|
if [ ! -d "venv" ]; then
|
||||||
|
echo -e "${B} No venv found, creating a new one ${E}"
|
||||||
python -m venv venv
|
python -m venv venv
|
||||||
fi
|
fi
|
||||||
|
source venv/bin/activate
|
||||||
|
|
||||||
venv/bin/pip install -r requirements.txt
|
|
||||||
|
echo -e "${B} Installing pip-tools ${E}"
|
||||||
|
pip install pip-tools
|
||||||
|
|
||||||
|
echo -e "${B} Downloading dependencies ${E}"
|
||||||
|
pip-sync
|
||||||
|
|
||||||
|
echo -e "${B} Copying config template. All custom config options can be set in the config.py file ${E}"
|
||||||
cd app
|
cd app
|
||||||
cp config.example.py config.py
|
cp config.example.py config.py
|
||||||
cp -t . database/*
|
|
||||||
venv/bin/python create_database.py
|
|
||||||
rm -f add_* create_database.py
|
|
||||||
venv/bin/python haldis.py runserver
|
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
|
echo -e "${B} Seeding database ${E}"
|
||||||
|
./populate-db.sh
|
||||||
|
|
||||||
|
echo -e "${B} Activate your venv using 'source venv/bin/activate'.\nThen run the server with 'python app/haldis.py runserver' ${E}"
|
||||||
|
|
|
@ -2,5 +2,5 @@
|
||||||
|
|
||||||
cd app
|
cd app
|
||||||
cp database/* .
|
cp database/* .
|
||||||
../venv/bin/python create_database.py
|
python create_database.py
|
||||||
rm -f add_* create_database.py muhscheme
|
rm -f add_* create_database.py muhscheme
|
||||||
|
|
11
requirements.in
Normal file
11
requirements.in
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
Flask
|
||||||
|
Flask-Login
|
||||||
|
Flask-Bootstrap
|
||||||
|
Flask-SQLAlchemy
|
||||||
|
Flask-DebugToolbar
|
||||||
|
airbrake
|
||||||
|
Flask-WTF
|
||||||
|
Flask-OAuthlib
|
||||||
|
Flask-Admin
|
||||||
|
Flask-Migrate
|
||||||
|
Flask-Script
|
|
@ -1,25 +1,40 @@
|
||||||
Flask==0.12
|
#
|
||||||
Flask-Admin==1.4.2
|
# This file is autogenerated by pip-compile
|
||||||
Flask-Bootstrap==3.3.7.1
|
# To update, run:
|
||||||
Flask-DebugToolbar==0.10.0
|
#
|
||||||
Flask-Login==0.4.0
|
# pip-compile
|
||||||
Flask-Migrate==2.0.3
|
#
|
||||||
Flask-OAuthlib==0.9.3
|
airbrake==2.1.2
|
||||||
Flask-SQLAlchemy==2.1
|
alembic==1.0.8 # via flask-migrate
|
||||||
Flask-Script==2.0.5
|
blinker==1.4 # via flask-debugtoolbar
|
||||||
Flask-WTF==0.14.2
|
certifi==2019.3.9 # via requests
|
||||||
Jinja2==2.9.5
|
chardet==3.0.4 # via requests
|
||||||
Mako==1.0.6
|
click==7.0 # via flask, pip-tools
|
||||||
MarkupSafe==0.23
|
dominate==2.3.5 # via flask-bootstrap
|
||||||
PyMySQL==0.7.9
|
flask-admin==1.5.3
|
||||||
SQLAlchemy==1.1.5
|
flask-bootstrap==3.3.7.1
|
||||||
WTForms==2.1
|
flask-debugtoolbar==0.10.1
|
||||||
Werkzeug==0.11.15
|
flask-login==0.4.1
|
||||||
airbrake==1.3.3
|
flask-migrate==2.4.0
|
||||||
alembic==0.8.10
|
flask-oauthlib==0.9.5
|
||||||
blinker==1.4
|
flask-script==2.0.6
|
||||||
itsdangerous==0.24
|
flask-sqlalchemy==2.3.2
|
||||||
oauthlib==2.0.1
|
flask-wtf==0.14.2
|
||||||
requests==2.13.0
|
flask==1.0.2
|
||||||
requests-oauthlib==0.7.0
|
idna==2.8 # via requests
|
||||||
six==1.10.0
|
itsdangerous==1.1.0 # via flask, flask-debugtoolbar
|
||||||
|
jinja2==2.10 # via flask
|
||||||
|
mako==1.0.8 # via alembic
|
||||||
|
markupsafe==1.1.1 # via jinja2, mako
|
||||||
|
oauthlib==2.1.0 # via flask-oauthlib, requests-oauthlib
|
||||||
|
pip-tools==3.6.0
|
||||||
|
python-dateutil==2.8.0 # via alembic
|
||||||
|
python-editor==1.0.4 # via alembic
|
||||||
|
requests-oauthlib==1.1.0 # via flask-oauthlib
|
||||||
|
requests==2.21.0 # via airbrake, requests-oauthlib
|
||||||
|
six==1.12.0 # via pip-tools, python-dateutil
|
||||||
|
sqlalchemy==1.3.2 # via alembic, flask-sqlalchemy
|
||||||
|
urllib3==1.24.1 # via requests
|
||||||
|
visitor==0.1.3 # via flask-bootstrap
|
||||||
|
werkzeug==0.15.2 # via flask, flask-debugtoolbar
|
||||||
|
wtforms==2.2.1 # via flask-admin, flask-wtf
|
||||||
|
|
Loading…
Reference in a new issue