Skip to content

Commit

Permalink
update config and dockermode
Browse files Browse the repository at this point in the history
  • Loading branch information
modemobpsycho committed Mar 25, 2024
1 parent 0955422 commit c42819a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
1 change: 1 addition & 0 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class Config(object):
MAIL_DEBUG = False
MAIL_USERNAME = config("MAIL_USERNAME", default="MAIL_USERNAME")
MAIL_PASSWORD = config("MAIL_PASSWORD", default="MAIL_PASSWORD")
FLASK_DOCKER = config("FLASK_DOCKER", default=os.getenv("FLASK_DOCKER"))
UPLOAD_FOLDER = config("UPLOAD_FOLDER", default=os.getenv("UPLOAD_FOLDER"))


Expand Down
19 changes: 13 additions & 6 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
from flask.cli import FlaskGroup
import os
from flask import Flask

from website import app, db
from website.accounts.models import User

import unittest
import getpass
from datetime import datetime
from dotenv import load_dotenv

basedir = os.path.abspath(os.path.dirname(__file__))
load_dotenv(os.path.join(basedir, ".env"))

app = FlaskGroup(app)


@app.command("test")
@app.cli.command("test")
def test():
tests = unittest.TestLoader().discover("tests")
with open("log_test.txt", "w") as f:
Expand All @@ -23,7 +25,7 @@ def test():
return 1


@app.command("create_admin")
@app.cli.command("create_admin")
def create_admin():
email = input("Enter email address: ")
password = getpass.getpass("Enter password: ")
Expand All @@ -48,4 +50,9 @@ def create_admin():


if __name__ == "__main__":
app()
if os.getenv("FLASK_DOCKER") == "True":
print("DOCKER MODE")
app.run(host="0.0.0.0", port=5000)
else:
print("LOCAL MODE")
app.run()
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pyScss==1.4.0
python-decouple==3.8
python-dotenv==1.0.1
six==1.16.0
SQLAlchemy==2.0.27
SQLAlchemy==2.0.29
toml==0.10.2
typing_extensions==4.10.0
Werkzeug==3.0.1
Expand Down

0 comments on commit c42819a

Please sign in to comment.