- Python version: 3.13.5
- Package manager systems used: miniconda3 + PyPI
- Requirements file
-
flask --app "filename".py runExplicitly specifies which Python file contains your Flask application and runs it. This command is useful when:
- Your Flask app file is not named
app.pyorwsgi.py(Flask's default names) - You have multiple Flask applications in the same directory
- You want to be explicit about which file to run
- Your Flask app file is not named
-
flask runStarts the Flask development server. This command runs your Flask application locally, making it accessible at
http://127.0.0.1:5000by default. -
flask run --debugStarts the Flask development server with debug mode enabled. Debug mode provides:
- Automatic reloading: Server restarts automatically when you save code changes
- Detailed error pages: Shows full stack traces and exact error locations in the browser
- Interactive debugger: Click on traceback lines to open a Python console (requires PIN)
- Enhanced logging: More verbose output in the terminal
Security Warning: Never use debug mode in production! The interactive debugger allows code execution.
- Content-Type:
application/x-www-form-urlencoded
- Select Body tab
- Choose x-www-form-urlencoded
- Add key-value pairs for form fields
- Don't use Flask's built-in server in production
- install Gunicorn or similar WSGI server
- Flask's development server (
flask run) is only for local development
- Never hardcode API keys
- use environment variables instead
- Check your code before pushing to GitHub to avoid exposing secrets
- Use
.envfiles locally and proper environment configuration in production
- Properly close database connections to prevent memory leaks
- Use SQLAlchemy's connection pooling for better performance under load
- Monitor your database connections in production
- Docker is essential, not overkill
- simplifies deployment with
docker-compose up
- simplifies deployment with
- Flask-CORS quickly fixes cross-origin request issues in APIs
- Replace Flask dev server with Gunicorn
- Move all secrets to environment variables
- Configure proper database connection handling
- Set up Docker containers
- Configure CORS if building an API
Bottom line: What works locally often breaks in production. Plan for proper production infrastructure from the start!