This is the backend server for the TripWise application, a comprehensive trip planning tool. It is built with Python and the Flask framework to provide a robust API for managing trip data, user information, and recommendation services.
- Python 3.12 or higher
Follow these instructions to get the backend server up and running on your local machine for development and testing purposes.
git clone <your-repository-url>
cd tw-serverCreate and activate a virtual environment. This will isolate the project's dependencies from your system-wide Python packages.
-
On Windows:
python -m venv .venv .venv\Scripts\activate
-
On macOS/Linux:
python -m venv .venv source .venv/bin/activate
Install all the required packages using pip and the requirements.txt file.
pip install -r requirements.txtThe application requires certain environment variables to be set. Copy the example file and update it with your configuration.
cp .env.example .envNow, edit the .env file with the necessary credentials and settings for your local environment (e.g., database URI, secret keys).
Before running the application, you need to apply the database migrations.
-
On Windows:
set FLASK_APP=wsgi.py flask db upgrade -
On macOS/Linux:
export FLASK_APP='wsgi.py' flask db upgrade
Once the setup is complete, you can start the Flask development server.
python wsgi.pyThe server will start on the default port (usually 5000).
When you make changes to the database models (in app/models.py), you'll need to create a new migration script and apply it.
-
Generate a new migration:
# Set FLASK_APP environment variable if you haven't already flask db migrate -m "Your descriptive migration message"
-
Apply the migration:
flask db upgrade
This will update your database schema to reflect the latest model definitions.