mirror of
https://github.com/Llloooggg/TextSouls.git
synced 2026-03-06 04:26:23 +03:00
init
This commit is contained in:
27
backend/__init__.py
Normal file
27
backend/__init__.py
Normal file
@@ -0,0 +1,27 @@
|
||||
import json
|
||||
|
||||
from flask import Flask
|
||||
from flask_sqlalchemy import SQLAlchemy
|
||||
from flask_migrate import Migrate
|
||||
|
||||
app = Flask(
|
||||
"__name__",
|
||||
)
|
||||
db = SQLAlchemy()
|
||||
migrate = Migrate(app, db)
|
||||
|
||||
with open("backend/config.json") as config_file:
|
||||
config_data = json.load(config_file)
|
||||
|
||||
main_settings = config_data["main_settings"]
|
||||
app.config.update(main_settings)
|
||||
|
||||
db_settings = config_data["db_settings"]
|
||||
app.config.update(db_settings)
|
||||
|
||||
db.init_app(app)
|
||||
|
||||
|
||||
from .main import main as main_blueprint
|
||||
|
||||
app.register_blueprint(main_blueprint)
|
||||
9
backend/config.json_template
Normal file
9
backend/config.json_template
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"main_settings": {
|
||||
"SECRET_KEY": "some-very-secret-key",
|
||||
"SQLALCHEMY_TRACK_MODIFICATIONS": false
|
||||
},
|
||||
"db_settings": {
|
||||
"SQLALCHEMY_DATABASE_URI": "postgresql://ownername:pass@localhost/dyxless"
|
||||
}
|
||||
}
|
||||
8
backend/main.py
Normal file
8
backend/main.py
Normal file
@@ -0,0 +1,8 @@
|
||||
from flask import Blueprint
|
||||
|
||||
main = Blueprint("main", __name__)
|
||||
|
||||
|
||||
@main.route("/")
|
||||
def index():
|
||||
return "Nice!", 200
|
||||
16
backend/requirements.txt
Normal file
16
backend/requirements.txt
Normal file
@@ -0,0 +1,16 @@
|
||||
alembic==1.8.1
|
||||
click==8.1.3
|
||||
Flask==2.2.2
|
||||
Flask-Migrate==4.0.0
|
||||
Flask-SQLAlchemy==3.0.2
|
||||
greenlet==2.0.1
|
||||
importlib-metadata==5.0.0
|
||||
importlib-resources==5.10.0
|
||||
itsdangerous==2.1.2
|
||||
Jinja2==3.1.2
|
||||
Mako==1.2.4
|
||||
MarkupSafe==2.1.1
|
||||
PyMySQL==1.0.2
|
||||
SQLAlchemy==1.4.44
|
||||
Werkzeug==2.2.2
|
||||
zipp==3.10.0
|
||||
8
backend/scripts/runserver.sh
Executable file
8
backend/scripts/runserver.sh
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
set echo off
|
||||
|
||||
export FLASK_APP=backend
|
||||
export FLASK_DEBUG=true
|
||||
|
||||
flask run
|
||||
Reference in New Issue
Block a user