config file
This commit is contained in:
parent
b94a3d2ae4
commit
d65bcb3e4a
6 changed files with 42 additions and 10 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -168,3 +168,5 @@ cython_debug/
|
||||||
|
|
||||||
instance/
|
instance/
|
||||||
images/
|
images/
|
||||||
|
|
||||||
|
config.json
|
||||||
|
|
13
README.md
13
README.md
|
@ -28,7 +28,15 @@ and you can also run the app using [./scripts/run.sh](./scripts/run.sh) to match
|
||||||
the run.sh as the first run.
|
the run.sh as the first run.
|
||||||
|
|
||||||
running with gunicorn (run.sh) is for production use, for master key generation (first run), please
|
running with gunicorn (run.sh) is for production use, for master key generation (first run), please
|
||||||
run it in dev mode:
|
run it in dev mode after making the config:
|
||||||
|
|
||||||
|
make the config:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
cp src/imag/config.sample.json src/imag/config.json && nano config.json
|
||||||
|
```
|
||||||
|
|
||||||
|
run it:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
python3 src/main.py
|
python3 src/main.py
|
||||||
|
@ -50,8 +58,9 @@ and then run it in debug
|
||||||
this comes from an email the original creator got from a user:
|
this comes from an email the original creator got from a user:
|
||||||
|
|
||||||
1. clone the repository: `git clone https://git.everypizza.im/n/imag`
|
1. clone the repository: `git clone https://git.everypizza.im/n/imag`
|
||||||
2. make sure you have virtualenv installed ( either through python-virtualenv / python3-virtualenv / py3-virtualenv packages, or by pip - `python3 -m pip install --user --break-system-packages --upgrade virtualenv`
|
2. make sure you have virtualenv installed (either through python-virtualenv / python3-virtualenv / py3-virtualenv packages, or by pip - `python3 -m pip install --user --break-system-packages --upgrade virtualenv`)
|
||||||
3. ensure you have sqlite3 and memcached installed: `apt install sqlite3 memcached`
|
3. ensure you have sqlite3 and memcached installed: `apt install sqlite3 memcached`
|
||||||
4. create a new virtual environment: `python3 -m virtualenv venv && source venv/bin/activate`
|
4. create a new virtual environment: `python3 -m virtualenv venv && source venv/bin/activate`
|
||||||
5. install the dependencies in the environment: `pip install -r requirements.txt`
|
5. install the dependencies in the environment: `pip install -r requirements.txt`
|
||||||
|
6. configure the instance: `cp src/imag/config.sample.json src/imag/config.json && nano config.json`
|
||||||
6. run the app by either running `scripts/run.sh` or by manually starting memcached and running `src/main.py` with gunicorn (i assume you're reverse proxying it anyway)
|
6. run the app by either running `scripts/run.sh` or by manually starting memcached and running `src/main.py` with gunicorn (i assume you're reverse proxying it anyway)
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
|
|
||||||
import secrets
|
import secrets
|
||||||
import typing as t
|
import typing as t
|
||||||
from os import makedirs
|
from os import makedirs, path
|
||||||
|
import json
|
||||||
import flask
|
import flask
|
||||||
from werkzeug.middleware.proxy_fix import ProxyFix
|
from werkzeug.middleware.proxy_fix import ProxyFix
|
||||||
|
|
||||||
|
@ -13,6 +13,11 @@ from . import const, models
|
||||||
from .api import api
|
from .api import api
|
||||||
from .views import views
|
from .views import views
|
||||||
|
|
||||||
|
configLocation = path.dirname(path.abspath(__file__))
|
||||||
|
with open(configLocation + '/config.json', 'r') as f:
|
||||||
|
config = json.load(f)
|
||||||
|
message = config["message"]
|
||||||
|
|
||||||
__version__: str = "3.1.2-nyx"
|
__version__: str = "3.1.2-nyx"
|
||||||
|
|
||||||
|
|
||||||
|
@ -54,6 +59,7 @@ def create_app(db: str = "sqlite:///imag.db") -> t.Tuple[flask.Flask, t.Optional
|
||||||
"desc_len": const.DESC_LEN,
|
"desc_len": const.DESC_LEN,
|
||||||
"key_len": const.KEY_LEN,
|
"key_len": const.KEY_LEN,
|
||||||
"imagv": __version__,
|
"imagv": __version__,
|
||||||
|
"imagmessage": message
|
||||||
}
|
}
|
||||||
|
|
||||||
@app.after_request
|
@app.after_request
|
||||||
|
|
3
src/imag/config.sample.json
Normal file
3
src/imag/config.sample.json
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"message": "meow"
|
||||||
|
}
|
|
@ -114,3 +114,7 @@ hr.thin{
|
||||||
width:50%;
|
width:50%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hr.tiny {
|
||||||
|
width:25%;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,6 +60,14 @@
|
||||||
<a href="https://matrix.to/#/@quotes-python:everypizza.im">@quotes-python:everypizza.im</a>
|
<a href="https://matrix.to/#/@quotes-python:everypizza.im">@quotes-python:everypizza.im</a>
|
||||||
</small>
|
</small>
|
||||||
</center>
|
</center>
|
||||||
|
<hr class="tiny">
|
||||||
|
<center>
|
||||||
|
<small>
|
||||||
|
Board message: {{ imagmessage }}
|
||||||
|
</small>
|
||||||
|
</center>
|
||||||
|
<hr class="thin">
|
||||||
|
|
||||||
|
|
||||||
{% with messages = get_flashed_messages(with_categories=True) %}
|
{% with messages = get_flashed_messages(with_categories=True) %}
|
||||||
{% if messages %}
|
{% if messages %}
|
||||||
|
|
Loading…
Add table
Reference in a new issue