Skip to content

Commit 4684278

Browse files
NishaNisha
Nisha
authored and
Nisha
committed
📖 Update: Steps to run the project
1 parent 2c05465 commit 4684278

File tree

2 files changed

+95
-0
lines changed

2 files changed

+95
-0
lines changed

README.md

+89
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,91 @@
11
# react-django-graphQL-postgres
22
GraphQL API in Django
3+
- Nisha Chaube
4+
5+
## Setting up using Docker
6+
7+
docker-compose up -d --build
8+
9+
docker ps
10+
11+
<!-- Login to react-django-graphql-postgres_core image -->
12+
13+
docker exec -it ####### /bin/bash
14+
15+
python manage.py makemigrations
16+
17+
python manage.py migrate
18+
19+
python manage.py loaddata ./Fixtures/initial_data.json
20+
21+
Django server url:
22+
React frontend url:
23+
24+
## Setting up Python environment
25+
26+
To get this project up and running you should start by having Python installed on your computer. It's advised you create a virtual environment to store your projects dependencies separately. You can install virtualenv with <br />
27+
28+
```
29+
pip install virtualenv
30+
```
31+
32+
Clone or download this repository and open it in your editor of choice. In a terminal (mac/linux) or windows terminal, run the following command in the base directory of this project
33+
34+
```
35+
python -m venv venv
36+
```
37+
38+
That will create a new folder `venv` in your project directory. Next activate it with this command on mac/linux:
39+
40+
```
41+
source venv/bin/activate
42+
```
43+
44+
Then install the project dependencies with
45+
46+
```
47+
pip install -r requirements.txt
48+
```
49+
50+
Now you can run the project with this command
51+
52+
```
53+
python manage.py runserver
54+
```
55+
56+
## Setting up postgresql database
57+
58+
### Install Postgresql **_Linux_**
59+
60+
```
61+
sudo apt-get install libpq-dev python-dev
62+
```
63+
64+
```
65+
sudo apt-get install postgresql postgresql-contrib
66+
```
67+
68+
### Install Postgresql **_Windows_**
69+
70+
[Tutorial PostgreSQL windows](https://www.postgresqltutorial.com/install-postgresql/)
71+
72+
### Setup Database and User in PostgreSQL
73+
74+
Based on these settings in [settings.py](/src/project/project/settings.py)
75+
76+
```python
77+
DATABASES = {
78+
"default": {
79+
"ENGINE": "django.db.backends.postgresql",
80+
"NAME": "postgres,
81+
"USER": "postgres",
82+
"PASSWORD": "postgres",
83+
"HOST": "db"
84+
}
85+
}
86+
```
87+
88+
89+
```SQL
90+
grant all privileges on database postgres to postgres
91+
```

requirements.txt

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
django
2+
psycopg2
3+
graphene_django
4+
graphene
5+
python-dotenv
6+
django-cors-headers

0 commit comments

Comments
 (0)