This application is built using Flask, a Python web framework. It provides functionality for user authentication, event management, and file handling.
- Getting Started
- Features
- Prerequisites
- Installation
- Configuration
- Usage
- API Endpoints
- Database Models
- Deployed Version
- DEMO
These instructions will help you set up and run the backend application on your local machine.
- User registration and authentication
- Event creation, retrieval, updating, and deletion
- File uploads for events
- User-specific event management
Before you begin, ensure you have the following installed on your machine:
- Python (version 3.7 or higher)
- pip (Python package manager)
-
Clone this repository to your local machine:
git clone <repository-url>
-
Change to the project directory:
cd <project-directory>
-
Activate the virtual environment:
- On Windows:
venv\Scripts\activate
- On macOS and Linux:
source venv/bin/activate
- On Windows:
-
Install the required packages:
pip install -r requirements.txt
Before running the application, make sure to set up your environment variables. You can do this by creating a .env file in the project directory and adding the following variables:
- SECRET_KEY: A secret key for Flask's session management.
- SQLALCHEMY_DATABASE_URI: The URI for your PostgreSQL database.
- SQLALCHEMY_TEST_DATABASE_URI: The URI for your test database (if applicable).
By default, the application will run on http://localhost:5000.
Here are the available API endpoints:
- POST /users/register: Register a new user.
- POST /users/login: Log in with a registered user.
- POST /users/logout: Log out a logged-in user.
- GET /users/username : Retrieve user information.
- GET /users: Retrieve information for all users.
- PUT /users/<user_id>: Update user information.
- DELETE /users/<user_id>: Delete a user.
- POST /events/create_event: Create a new event.
- GET /events/<event_id>: Retrieve information for a specific event.
- GET /events: Retrieve information for all events.
- GET /events/all: Retrieve information for all events (alternative endpoint).
- PUT /events/<event_id>: Update event information.
- DELETE /events/<event_id>: Delete an event.
- GET /users/<user_id>/events: Retrieve all events for a specific user.
The application uses SQLAlchemy to interact with the database. Here are the relevant database models:
User: Represents a user with username, email, and password fields.Event: Represents an event with title, event type, location, date, description, and file data fields.
You can access a deployed version of this application on Fly.io. Fly.io is a platform for deploying and scaling applications. For more information on deploying Python applications with Fly.io, refer to the Fly.io Python Documentation.
-
- This endpoint provides access to event data.
-
- Due to the application's login authentication system, accessing this URL without proper authorization will result in an "Unauthorized" message.
Note: I am currently working on the frontend application of this project. Once the register and login forms are added to the frontend application, the authentication system will work seamlessly. You can find the frontend repository for this project Here.