Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update manage.py #27

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,34 @@
from flask_migrate import Migrate, MigrateCommand
from flask_script import Manager
from eeazycrm.config import DevelopmentConfig, TestConfig, ProductionConfig

import os

# Initialize the Flask application
app = Flask(__name__, instance_relative_config=True)

config_class = ProductionConfig()
# Determine the configuration class based on the environment variable
config_class = ProductionConfig() # Default to ProductionConfig
if os.getenv('FLASK_ENV') == 'development':
config_class = DevelopmentConfig()
elif os.getenv('FLASK_ENV') == 'production':
config_class = ProductionConfig()
elif os.getenv('FLASK_ENV') == 'testing':
config_class = TestConfig()

# Load the configuration into the app
app.config.from_object(config_class)

# Initialize extensions
db = SQLAlchemy(app)
migrate = Migrate(app, db)

# Set up the command manager
manager = Manager(app)
manager.add_command('db', MigrateCommand)


class TestUser(db.Model):
# Define a sample model
class TestUser (db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(128))


# Run the application
if __name__ == '__main__':
manager.run()