ShareTrips is a web application designed for travelers who want to share their routes and tourist experiences in Spain. With ShareTrips, users can comment on shared routes, follow other travelers, and discover new exciting destinations.
ShareTrips helps users to:
- Share and publish tourist routes in Spain.
- Comment and give feedback on other travelers' routes.
- Follow profiles to stay up-to-date with their travel recommendations.
- Frontend: React.js, CSS, Bootstrap for an engaging and responsive user experience.
- Backend: Python Flask for the API, JWT for secure authentication, and MySQL for storing user, route, and comment data.
This project can be run both locally and in a cloud environment like Github Codespaces or Gitpod.
If you use Github Codespaces (recommended) or Gitpod this template will already come with Python, Node and the Posgres Database installed. If you are working locally make sure to install Python 3.10, Node
It is recomended to install the backend first, make sure you have Python 3.8, Pipenv and a database engine (Posgress recomended)
- Install the python packages:
$ pipenv install
- Install JWT packages :
$ pipenv install flask-jwt-extended
- Install Bcrypt:
$ pipenv install bcrypt
- Create a .env file based on the .env.example:
$ cp .env.example .env
- Install your database engine and create your database, depending on your database you have to create a DATABASE_URL variable with one of the possible values, make sure you replace the valudes with your database information:
Engine | DATABASE_URL |
---|---|
SQLite | sqlite:////test.db |
MySQL | mysql://username:password@localhost:port/example |
Postgress | postgres://username:password@localhost:5432/example |
- Migrate the migrations:
$ pipenv run migrate
(skip if you have not made changes to the models on the./src/api/models.py
) - Run the migrations:
$ pipenv run upgrade
- Run the application:
$ pipenv run start
Note: Codespaces users can connect to psql by typing:
psql -h localhost -U gitpod example
You are also able to undo a migration by running
$ pipenv run downgrade
To insert test users in the database execute the following command:
$ flask insert-test-users 5
And you will see the following message:
Creating test users
[email protected] created.
[email protected] created.
[email protected] created.
[email protected] created.
[email protected] created.
Users created successfully!
Every Github codespace environment will have its own database, so if you're working with more people eveyone will have a different database and different records inside it. This data will be lost, so don't spend too much time manually creating records for testing, instead, you can automate adding records to your database by editing commands.py
file inside /src/api
folder. Edit line 32 function insert_test_data
to insert the data according to your model (use the function insert_test_users
above as an example). Then, all you need to do is run pipenv run insert-test-data
.
- Make sure you are using node version 14+ and that you have already successfully installed and runned the backend.
- Install the packages:
$ npm install
- Start coding! start the webpack dev server
$ npm run start
@JaviJota, @ivanzr17