Basic template
This commit is contained in:
parent
bd63ae9a4d
commit
6bceef1664
9 changed files with 66 additions and 0 deletions
13
app/__init__.py
Normal file
13
app/__init__.py
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
from flask import Flask
|
||||
from flask_sqlalchemy import SQLAlchemy
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
# Configuration of application, see configuration.py, choose one and uncomment.
|
||||
# app.config.from_object('configuration.ProductionConfig')
|
||||
app.config.from_object("app.configuration.DevelopmentConfig")
|
||||
# app.config.from_object('configuration.TestingConfig')
|
||||
|
||||
db = SQLAlchemy(app) # flask-sqlalchemy
|
||||
|
||||
from app import views, models
|
||||
BIN
app/__pycache__/__init__.cpython-312.pyc
Normal file
BIN
app/__pycache__/__init__.cpython-312.pyc
Normal file
Binary file not shown.
BIN
app/__pycache__/configuration.cpython-312.pyc
Normal file
BIN
app/__pycache__/configuration.cpython-312.pyc
Normal file
Binary file not shown.
BIN
app/__pycache__/models.cpython-312.pyc
Normal file
BIN
app/__pycache__/models.cpython-312.pyc
Normal file
Binary file not shown.
BIN
app/__pycache__/views.cpython-312.pyc
Normal file
BIN
app/__pycache__/views.cpython-312.pyc
Normal file
Binary file not shown.
20
app/configuration.py
Normal file
20
app/configuration.py
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
class Config(object):
|
||||
DEBUG = False
|
||||
TESTING = False
|
||||
SQLALCHEMY_DATABASE_URI = "sqlite:///application.db"
|
||||
BOOTSTRAP_FONTAWESOME = True
|
||||
SECRET_KEY = "MINHACHAVESECRETA"
|
||||
CSRF_ENABLED = True
|
||||
SQLALCHEMY_TRACK_MODIFICATIONS = True
|
||||
|
||||
# Get your reCaptche key on: https://www.google.com/recaptcha/admin/create
|
||||
# RECAPTCHA_PUBLIC_KEY = "6LffFNwSAAAAAFcWVy__EnOCsNZcG2fVHFjTBvRP"
|
||||
# RECAPTCHA_PRIVATE_KEY = "6LffFNwSAAAAAO7UURCGI7qQ811SOSZlgU69rvv7"
|
||||
|
||||
|
||||
class DevelopmentConfig(Config):
|
||||
DEBUG = True
|
||||
|
||||
|
||||
class TestingConfig(Config):
|
||||
TESTING = True
|
||||
20
app/models.py
Normal file
20
app/models.py
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
from app import db
|
||||
|
||||
|
||||
class Item(db.Model):
|
||||
id = db.Column(db.Integer, primary_key=True)
|
||||
title = db.Column(db.String(250))
|
||||
description = db.Column(db.Text)
|
||||
price = db.Column(db.Float)
|
||||
bought = db.Column(db.Boolean)
|
||||
|
||||
|
||||
class Wishlist(db.Model):
|
||||
id = db.Column(db.Integer, primary_key=True)
|
||||
editId = db.Column(db.Uuid)
|
||||
viewId = db.Column(db.Uuid)
|
||||
title = db.Column(db.String(250))
|
||||
description = db.Column(db.Text)
|
||||
|
||||
itemIds = db.Column(db.ARRAY(db.Integer)) # Store item IDs as an array
|
||||
items = db.relationship("Item", primaryjoin="Wishlist.itemIds")
|
||||
7
app/views.py
Normal file
7
app/views.py
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
from flask import url_for, redirect, render_template, flash, g, session
|
||||
from app import app
|
||||
|
||||
|
||||
@app.route("/")
|
||||
def index():
|
||||
return "hello"
|
||||
6
run.py
Normal file
6
run.py
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
import os
|
||||
from app import app
|
||||
|
||||
if __name__ == "__main__":
|
||||
port = int(os.environ.get("PORT", 5000))
|
||||
app.run(host="0.0.0.0", port=port)
|
||||
Loading…
Add table
Add a link
Reference in a new issue