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/
|
||||
images/
|
||||
|
||||
config.json
|
||||
|
|
25
README.md
25
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.
|
||||
|
||||
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
|
||||
python3 src/main.py
|
||||
|
@ -37,7 +45,7 @@ python3 src/main.py
|
|||
(make sure to save the key!)
|
||||
and only then with gunicorn
|
||||
|
||||
if you already ran it in production and don't know where the key is, run the following command :
|
||||
if you already ran it in production and don't know where the key is, run the following command:
|
||||
|
||||
```sh
|
||||
rm -rf src/instance
|
||||
|
@ -49,9 +57,10 @@ and then run it in debug
|
|||
|
||||
this comes from an email the original creator got from a user:
|
||||
|
||||
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`
|
||||
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`
|
||||
5. install the dependencies in the environment : `pip install -r requirements.txt`
|
||||
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 )
|
||||
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`)
|
||||
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`
|
||||
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)
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
|
||||
import secrets
|
||||
import typing as t
|
||||
from os import makedirs
|
||||
|
||||
from os import makedirs, path
|
||||
import json
|
||||
import flask
|
||||
from werkzeug.middleware.proxy_fix import ProxyFix
|
||||
|
||||
|
@ -13,6 +13,11 @@ from . import const, models
|
|||
from .api import api
|
||||
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"
|
||||
|
||||
|
||||
|
@ -54,6 +59,7 @@ def create_app(db: str = "sqlite:///imag.db") -> t.Tuple[flask.Flask, t.Optional
|
|||
"desc_len": const.DESC_LEN,
|
||||
"key_len": const.KEY_LEN,
|
||||
"imagv": __version__,
|
||||
"imagmessage": message
|
||||
}
|
||||
|
||||
@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%;
|
||||
}
|
||||
|
||||
hr.tiny {
|
||||
width:25%;
|
||||
}
|
||||
|
||||
|
|
|
@ -60,6 +60,14 @@
|
|||
<a href="https://matrix.to/#/@quotes-python:everypizza.im">@quotes-python:everypizza.im</a>
|
||||
</small>
|
||||
</center>
|
||||
<hr class="tiny">
|
||||
<center>
|
||||
<small>
|
||||
Board message: {{ imagmessage }}
|
||||
</small>
|
||||
</center>
|
||||
<hr class="thin">
|
||||
|
||||
|
||||
{% with messages = get_flashed_messages(with_categories=True) %}
|
||||
{% if messages %}
|
||||
|
|
Loading…
Add table
Reference in a new issue