This repository contains the source code of the Brawlclub.app website.
This web app allows you to find clubs that match your criteria in Brawl Stars, a Supercell game. It also shows you statistics about yourself or clubs!
Please install all these:
- Python > = 3.8
- Git
- Redis (optional but runs on production)
- PostgreSQL
- Node Package Manager
- React JS
cd <future project folder>
git clone [email protected]:Shriukan33/OC-P13-BrawlClub.git
cd OC-P13-BrawlClub
python -m venv venv
venv/Scripts/activate
. venv/bin/activate
pip install -r requirements.txt
There are two environment variables files:
- In BrawlClub/.env.template
- In BrawlClub/bc_frontend/dotenv.template
Fill in the different fields as necessary, instructions are in the file.
Note that brawl stars API keys are free, if you want to use several, you may create several and make a single string with several keys, separated by a '#'.
Example:
BRAWLSTARS_API_KEY = "thisIsKey1#thisIsKey2"
(Optional)
Redis server is used to cache leaderboard pages, as they are computation heavy.
Use the command redis-server
to start the cache server and keep the terminal open.
You should see something that looks like this:
Create the database using pgSQL:
psql -d postgres
CREATE DATABASE brawlclub;
grant all privileges on database brawlclub to <user you want to give the privileges>;
alter database brawlclub owner to <user you want to give the privileges> ;
quit;
You don't have to create a specific user, the default postgres
can do the work.
-
If you have your virtual environment activated, move your working directory to the same directory as
manage.py
(P13_BS_API/BrawlClub/) and use this command:python manage.py migrate
to create the tables in the database. -
You may also create a superuser using
python manage.py createsuperuser
, this will allow you to login into the admin panel in http://127.0.0.1:8000/admin
Use the following command
python manage.py runserver
Fill Django's address (by default, 127.0.0.1:8000)
cd bc_frontend/
npm install
npm start
If you use Redis, you may want to launch the tests with the cache server running. To launch the tests, first activate the redis server
redis-server
then, while having your venv activated, move to migrate.py directory and use:
python manage.py test
You're done! You may now head to localhost:3000 to see the landing page!