Update env file
This commit is contained in:
parent
0731585373
commit
2a70ca9dae
6
app.py
6
app.py
@ -3,8 +3,9 @@
|
||||
# =========================
|
||||
# Librarys
|
||||
# =========================
|
||||
from dotenv import load_dotenv, find_dotenv
|
||||
import os
|
||||
from os.path import join, dirname
|
||||
from dotenv import load_dotenv
|
||||
from flask import Flask, request
|
||||
from flask_restplus import Resource, Api
|
||||
from models import db, User, Notice, Comment
|
||||
@ -13,7 +14,8 @@ from flask_marshmallow import Marshmallow
|
||||
# =========================
|
||||
# Extensions initialization
|
||||
# =========================
|
||||
load_dotenv(find_dotenv())
|
||||
dotenv_path = join(dirname(__file__), 'env')
|
||||
load_dotenv(dotenv_path)
|
||||
app = Flask(__name__)
|
||||
ma = Marshmallow(app)
|
||||
api = Api(app)
|
||||
|
3
env
Normal file
3
env
Normal file
@ -0,0 +1,3 @@
|
||||
DEBUG=True
|
||||
DATABASE_URI='sqlite:///database.sqlite'
|
||||
SECRET_KEY='my secret'
|
23
models.py
23
models.py
@ -1,14 +1,17 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Librarys
|
||||
import os
|
||||
from os.path import join, dirname
|
||||
from flask import Flask
|
||||
from datetime import datetime
|
||||
from flask_sqlalchemy import SQLAlchemy
|
||||
from flask_script import Manager
|
||||
from flask_migrate import Migrate, MigrateCommand
|
||||
from dotenv import load_dotenv, find_dotenv
|
||||
from dotenv import load_dotenv
|
||||
|
||||
dotenv_path = join(dirname(__file__), 'env')
|
||||
load_dotenv(dotenv_path)
|
||||
|
||||
load_dotenv(find_dotenv())
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
@ -58,7 +61,11 @@ class Notice(db.Model):
|
||||
|
||||
# Relations
|
||||
user = db.relationship(
|
||||
'User', backref=db.backref('Notice', lazy=True, cascade="all, delete-orphan"))
|
||||
'User',
|
||||
backref=db.backref(
|
||||
'Notice',
|
||||
lazy=True,
|
||||
cascade="all, delete-orphan"))
|
||||
|
||||
def __repr__(self):
|
||||
return '<Notice Table {0}>'.format(self.title)
|
||||
@ -82,9 +89,13 @@ class Comment(db.Model):
|
||||
|
||||
# Relations
|
||||
user = db.relationship(
|
||||
'User', backref=db.backref('Comment', lazy=True, cascade="all, delete-orphan"))
|
||||
notice = db.relationship(
|
||||
'Notice', backref=db.backref('Comment', lazy=True, cascade="all, delete-orphan"))
|
||||
'User',
|
||||
backref=db.backref(
|
||||
'Comment',
|
||||
lazy=True,
|
||||
cascade="all, delete-orphan"))
|
||||
notice = db.relationship('Notice', backref=db.backref(
|
||||
'Comment', lazy=True, cascade="all, delete-orphan"))
|
||||
|
||||
def __repr__(self):
|
||||
return '<Comment Table {0}>'.format(self.id)
|
||||
|
Loading…
Reference in New Issue
Block a user