Openex is an API designed for a stock exchange platform. This application is built using Flask and integrates various extensions and services to provide a comprehensive and robust backend for managing user authentication, transactions, profiles, and more.
- User authentication and session management
- Database migrations
- Transaction handling
- Profile management
- Localization and translation support
- Email notifications for errors
- Structured logging
- Python 3.8+
- Flask
- Flask extensions: Flask-SQLAlchemy, Flask-Migrate, Flask-Login, Flask-Mail, Flask-Moment, Flask-Babel
-
Clone the repository:
git clone https://github.com/mpereannor/openex.git cd openex
-
Create a virtual environment:
python -m venv venv
-
Activate the virtual environment:
- On Windows:
venv\Scripts\activate
- On macOS/Linux:
source venv/bin/activate
- On Windows:
-
Install the required packages:
pip install -r requirements.txt
-
Set up the environment variables:
export FLASK_APP=openex export FLASK_ENV=development
-
Initialize the database:
flask db upgrade
Configuration settings are managed in the config.py
file. You can create a custom configuration class by extending the base Config
class and overriding necessary attributes.
-
Start the Flask application:
flask run
-
The application will be available at
http://127.0.0.1:5000/
.
The application is structured using Flask Blueprints to separate different functionalities:
- Auth: Handles user authentication.
- Errors: Manages error handling and custom error pages.
- Main: The main application logic.
- Profile: Manages user profiles.
- Transactions: Handles stock exchange transactions.
Logging is configured to send error logs via email when the application is in production. Additionally, logging can be configured to write to a rotating file.
Localization support is provided using Flask-Babel. The _l
function is used to mark strings for translation.
For deployment, ensure that the FLASK_ENV
is set to production
and configure your web server to serve the application. Detailed instructions for deployment can be found in the Flask documentation.
Contributions are welcome! Please submit a pull request or open an issue to discuss potential changes.
This project is licensed under the MIT License. See the LICENSE
file for details.