Fixed config
- config didn't work now it's working properly - it takes config from envirionment variable FLASK_CONFIG - if no such variable exists it uses Development config as default
This commit is contained in:
15
app/__init__.py
Normal file
15
app/__init__.py
Normal file
@@ -0,0 +1,15 @@
|
||||
from flask import Flask
|
||||
from flask_sqlalchemy import SQLAlchemy
|
||||
import os
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
config_string = os.environ.get("FLASK_CONFIG", "config.DevelopmentConfig")
|
||||
app.config.from_object("config.DevelopmentConifg")
|
||||
app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///app.db"
|
||||
app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = False
|
||||
|
||||
db = SQLAlchemy(app)
|
||||
|
||||
from . import routes
|
||||
|
11
app/requirements.txt
Normal file
11
app/requirements.txt
Normal file
@@ -0,0 +1,11 @@
|
||||
click==8.1.3
|
||||
Flask==2.2.2
|
||||
Flask-SQLAlchemy==3.0.2
|
||||
greenlet==2.0.1
|
||||
importlib-metadata==5.0.0
|
||||
itsdangerous==2.1.2
|
||||
Jinja2==3.1.2
|
||||
MarkupSafe==2.1.1
|
||||
SQLAlchemy==1.4.44
|
||||
Werkzeug==2.2.2
|
||||
zipp==3.10.0
|
7
app/routes.py
Normal file
7
app/routes.py
Normal file
@@ -0,0 +1,7 @@
|
||||
from flask import render_template
|
||||
|
||||
from . import app
|
||||
|
||||
@app.route("/", methods=["GET"])
|
||||
def index():
|
||||
return render_template("pages/index.html")
|
3
app/tasks.py
Normal file
3
app/tasks.py
Normal file
@@ -0,0 +1,3 @@
|
||||
def example_task(n: int) -> int:
|
||||
""" Example task"""
|
||||
return n**n
|
3
app/templates/includes/footer.html
Normal file
3
app/templates/includes/footer.html
Normal file
@@ -0,0 +1,3 @@
|
||||
<footer>
|
||||
<hr>
|
||||
</footer>
|
4
app/templates/includes/header.html
Normal file
4
app/templates/includes/header.html
Normal file
@@ -0,0 +1,4 @@
|
||||
<header>
|
||||
<h1>App</h1>
|
||||
<hr>
|
||||
</header>
|
13
app/templates/layouts/base.html
Normal file
13
app/templates/layouts/base.html
Normal file
@@ -0,0 +1,13 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>App</title>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
{% include "includes/header.html" %}
|
||||
{% block content %}{% endblock content %}
|
||||
{% include "includes/footer.html" %}
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
5
app/templates/pages/index.html
Normal file
5
app/templates/pages/index.html
Normal file
@@ -0,0 +1,5 @@
|
||||
{% extends "layouts/base.html" %}
|
||||
|
||||
{% block content %}
|
||||
Hello
|
||||
{% endblock %}
|
Reference in New Issue
Block a user