]> git.lizzy.rs Git - cheatdb.git/blob - README.md
Add meta package selector
[cheatdb.git] / README.md
1 # Content Database
2
3 ## Setup
4
5 First create a Python virtual env:
6
7         virtualenv env -ppython3
8         source env/bin/activate
9
10 then use pip:
11
12         pip3 install -r requirements.txt
13
14 ### Development
15
16 * Copy config.example.cfg to config.cfg
17 * Fill SECRET_KEY and WTF_CSRF_SECRET_KEY in with a random string
18 * Make a Github OAuth Client at <https://github.com/settings/developers>:
19         * Homepage URL - `http://localhost:5000/`
20         * Authorization callback URL - `http://localhost:5000/user/github/callback/`
21 * Put client id and client secret in GITHUB_CLIENT_ID and GITHUB_CLIENT_SECRET
22 * Setup the database: python3 setup.py
23
24
25 ## Running
26
27 ### Development
28
29 You need to enter the virtual environment if you haven't yet in
30 the current session:
31
32         source env/bin/activate
33
34 If you need to, reset the db like so:
35
36         python3 setup.py -t
37
38 Then run the server:
39
40         ./rundebug.py
41
42 Then view in your web browser: http://localhost:5000/
43
44 ## How-tos
45
46 ### Start celery worker
47
48 ```sh
49 FLASK_CONFIG=../config.cfg celery -A app.tasks.celery worker
50 ```
51
52 ### Create migration
53
54 ```sh
55 # if sqlite
56 python setup.py -t
57 rm db.sqlite && python setup.py -t && FLASK_CONFIG=../config.cfg FLASK_APP=app/__init__.py flask db stamp head
58
59 # Create migration
60 FLASK_CONFIG=../config.cfg FLASK_APP=app/__init__.py flask db migrate
61
62 # Run migration
63 FLASK_CONFIG=../config.cfg FLASK_APP=app/__init__.py flask db migrate
64 ```