Update env file

This commit is contained in:
Andros 2018-02-11 18:02:41 +01:00
parent 0731585373
commit 2a70ca9dae
3 changed files with 24 additions and 8 deletions

6
app.py
View File

@ -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
View File

@ -0,0 +1,3 @@
DEBUG=True
DATABASE_URI='sqlite:///database.sqlite'
SECRET_KEY='my secret'

View File

@ -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)