Spaces:
Running
Running
Fix database URI to use SQLite and correct import in main.py
Browse files
app.py
CHANGED
|
@@ -4,7 +4,7 @@ import os
|
|
| 4 |
from werkzeug.utils import secure_filename
|
| 5 |
|
| 6 |
app = Flask(__name__)
|
| 7 |
-
app.config['SQLALCHEMY_DATABASE_URI'] = "
|
| 8 |
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
|
| 9 |
UPLOAD_FOLDER = 'static/uploads'
|
| 10 |
app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
|
|
|
|
| 4 |
from werkzeug.utils import secure_filename
|
| 5 |
|
| 6 |
app = Flask(__name__)
|
| 7 |
+
app.config['SQLALCHEMY_DATABASE_URI'] = "sqlite:///courses.db"
|
| 8 |
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
|
| 9 |
UPLOAD_FOLDER = 'static/uploads'
|
| 10 |
app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
|
main.py
CHANGED
|
@@ -1,10 +1,10 @@
|
|
| 1 |
-
import os
|
| 2 |
-
from
|
| 3 |
|
| 4 |
# Create database tables if they don't exist
|
| 5 |
with app.app_context():
|
| 6 |
db.create_all()
|
| 7 |
|
| 8 |
-
if __name__ == '__main__':
|
| 9 |
-
port = int(os.environ.get("PORT", 5000))
|
| 10 |
-
app.run(host="0.0.0.0", port=port)
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
from app import app, db
|
| 3 |
|
| 4 |
# Create database tables if they don't exist
|
| 5 |
with app.app_context():
|
| 6 |
db.create_all()
|
| 7 |
|
| 8 |
+
if __name__ == '__main__':
|
| 9 |
+
port = int(os.environ.get("PORT", 5000))
|
| 10 |
+
app.run(host="0.0.0.0", port=port, debug=True)
|