We follow a systematic Git Workflow -
- Create a fork of this repo.
- Clone your fork of your repo on your pc.
- Add Upstream to your clone
- Every change that you do, it has to be on a branch. Commits on master would directly be closed.
- Make sure that before you create a new branch for new changes,syncing with upstream is neccesary.
-
Fork the repo and clone it.
-
If you had a previous version of the project, please delete the old env folder and create a new one
-
The project now uses
pipenv
to manage dependencies. So, virtual environment creation will also be handled by pipenv -
Install Pipenv
-
(Only for Linux users) At the root of your project directory
sudo apt-get update
sudo apt-get install libpq-dev python-dev
-
Run these commands
pipenv install
pre-commit install
-
This will setup the project requirements and pre-commit test hooks!
-
Ensure you have PostgreSQl installed on your machine and don't forget to add that in your environment variables.
-
Open Command prompt or Terminal, and login into postgres by entering the following command:
psql -U postgres -h localhost
-
Create a new admin user in postgres with username
thapar_olx
and passwordthapar_olx
by using the following command:
CREATE USER thapar_olx WITH ENCRYPTED PASSWORD 'thapar_olx'
-
You can confirm that user is created or not by using the following command
\du
-
Create a new database in postgres with name
thapar_olx
owned by the user created in previous step by using the following command:
create database thapar_olx
-
You can confirm that your database is created or not by using the following command
\l
-
Now, to grant priviledges, use the following command:
GRANT ALL PRIVILEDGES ON DATABASE thapar_olx TO thapar_olx;
this message appears stating that you have successfully granted priviledges to userthapar_olx
for databasethapar_olx
:
GRANT
-
Check via entering the following command:
\l
-
Ensure that postgres server is running on default port 5432.
-
To activate the virtual environment made by pipenv run
pipenv shell
-
After the above setup, run
python manage.py makemigrations
python manage.py migrate
-
Start the backend dev server
python manage.py runserver
Runs the backend server at default port8000
.
Open http://localhost:8000 to view it in the browser. -
To exit the pipenv virtual environment run
exit
.
- At your root directory run
yarn install
to install all the dependencies - Start react dev server
yarn start
Runs the app in the development mode.
Open http://localhost:3000 to view it in the browser.
The page will reload if you make edits.
You will also see any lint errors in the console.
- Ensure that you have
docker
anddocker-compose
already installed. - At the root of the project directory run
docker-compose build
to build the image for the first time. - To start the backend run
docker-compose up -d
. - Ensure that the backend is running by going to http://127.0.0.1:8000.
- Create a new project with name Thapar OLX in Google Cloud Platform.
- Enable Cloud OS Login API from the API Library in Google Cloud Platform.
- Go to API & Services section and click on Create Credential.
- Choose OAuth Client ID.
- Setup the consent screen if asked to do so.
- Select Web Application as the Application Type.
- Whitelist
localhost:3000
under Authorised Javascript Origins. - Click on Create
- Copy the ClientID and paste it in
.env
file alongside REACT_APP_OAUTH_CLIENT_ID.
- First, you need a service account for connecting to GCP
- Head over to this page and click on Create Service Account
- Select the relavant project
- From the dropdown for Service Account choose New-service account
- Download the
JSON
file and store it at your project root. - Rename the file to
service-account.json
- Set
GOOGLE_APPLICATION_CREDENTIALS
to the path toservice-account.json
in above point in the.env
file. - Create a bucket on GCP with the relavant name
- Copy the bucket name and in
.env
file setGS_BUCKET_NAME
to your bucket name.
- As the project now uses
pipenv
to manage dependencies, you need to runpipenv install <package_name>
to install the new package. - Use only
yarn add package_name
to add new packages to the frontend part.