Remove deprecated files and templates: Delete unused files including deployment scripts, environment configurations, and various HTML templates to streamline the project structure. This cleanup enhances maintainability and reduces clutter in the codebase.
This commit is contained in:
34
utils/server.py
Executable file
34
utils/server.py
Executable file
@@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
# Add the parent directory to path so we can import the app
|
||||
parent_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
sys.path.insert(0, parent_dir)
|
||||
|
||||
from app import app
|
||||
|
||||
def run_development_server(host='127.0.0.1', port=5000, debug=True):
|
||||
"""Run the Flask development server."""
|
||||
try:
|
||||
print(f"Starting development server on http://{host}:{port}")
|
||||
print("Press CTRL+C to stop the server")
|
||||
app.run(host=host, port=port, debug=debug)
|
||||
return True
|
||||
except Exception as e:
|
||||
print(f"Error starting development server: {e}")
|
||||
return False
|
||||
|
||||
if __name__ == "__main__":
|
||||
import argparse
|
||||
|
||||
parser = argparse.ArgumentParser(description='Run the development server')
|
||||
parser.add_argument('--host', default='127.0.0.1', help='Host to bind to')
|
||||
parser.add_argument('--port', type=int, default=5000, help='Port to bind to')
|
||||
parser.add_argument('--debug', action='store_true', default=True, help='Enable debug mode')
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
run_development_server(host=args.host, port=args.port, debug=args.debug)
|
||||
Reference in New Issue
Block a user