__init__.py 948 Bytes
Newer Older
Lukas Böhm's avatar
Lukas Böhm committed
1
2
3
import os
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
Lukas Böhm's avatar
Lukas Böhm committed
4
5
from redis import Redis
from rq import Queue
Lukas Böhm's avatar
Lukas Böhm committed
6

Lukas Böhm's avatar
Lukas Böhm committed
7
print('WE GOIN IN BOIS')
Lukas Böhm's avatar
Lukas Böhm committed
8
basedir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
Lukas Böhm's avatar
Lukas Böhm committed
9
datadir = os.path.abspath(os.path.join(basedir, 'data'))
Lukas Böhm's avatar
Lukas Böhm committed
10
print(basedir)
Lukas Böhm's avatar
Lukas Böhm committed
11
print(datadir)
Lukas Böhm's avatar
Lukas Böhm committed
12

Lukas Böhm's avatar
Lukas Böhm committed
13
app = Flask(__name__)
Lukas Böhm's avatar
Lukas Böhm committed
14
app.config['SECRET_KEY'] = os.getenv('SECRET_KEY') or 'jonas ist ein kek'
Lukas Böhm's avatar
Lukas Böhm committed
15
16
app.config['MEDIA_LOCATION'] = os.getenv('MEDIA_LOCATION') or os.path.join(datadir, 'media')
app.config['SQLALCHEMY_DATABASE_URI'] = os.getenv('DATABASE_URI') or 'sqlite:///' + os.path.join(datadir, 'home.db')
Lukas Böhm's avatar
Lukas Böhm committed
17
18
19
20
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
app.config['MAX_MEDIA_SIZE'] = 1000 * 1024 * 1024  # 1000 MB

db = SQLAlchemy(app)
Lukas Bhm's avatar
Lukas Bhm committed
21
22
#task_queue = Queue(connection=Redis.from_url('redis://chiefsend-redis'))
task_queue = Queue(connection=Redis())
Lukas Böhm's avatar
Lukas Böhm committed
23

Lukas Böhm's avatar
Lukas Böhm committed
24
25
26
27
28
29
from app.models import *

db.create_all()
db.session.commit()

from app import routes