Browse Source

Development commit

master^2
adiao 4 years ago
parent
commit
8f24d252dd
  1. 2
      .idea/flaskProject2.iml
  2. 2
      .idea/misc.xml
  3. 6
      static/config.py
  4. 21
      static/init.py

2
.idea/flaskProject2.iml

@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/venv" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="jdk" jdkName="Python 3.10 (venv)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="TemplatesService">

2
.idea/misc.xml

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9 (venv)" project-jdk-type="Python SDK" />
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10 (venv)" project-jdk-type="Python SDK" />
</project>

6
static/config.py

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
import os
class Config(object):
class Config:
"""
全局配置
"""
@ -9,7 +9,7 @@ class Config(object): @@ -9,7 +9,7 @@ class Config(object):
SQLALCHEMY_COMMIT_ON_TEARDOWN = True
@staticmethod
def __init_app(app):
def init_app(app):
pass
@ -63,4 +63,4 @@ config = { @@ -63,4 +63,4 @@ config = {
'testing': TestingConfig,
'production': ProductionConfig,
'default': DevelopmentConfig
}
}

21
static/init.py

@ -0,0 +1,21 @@ @@ -0,0 +1,21 @@
"""
@Project KuajBang
@File init.py
@Author AiNiSuBing
@Date 2022/5/6 15:05
"""
from config import config
from flask_sqlalchemy import SQLAlchemy
from flask import Flask, render_template
db = SQLAlchemy()
def create_app(config_name):
global app
app = Flask(app)
app.config.from_object(config[config_name])
config[config_name].init_app(app)
db.init_app(app)
return app
Loading…
Cancel
Save