Skip to content

Commit

Permalink
[improvement] Update README.md
Browse files Browse the repository at this point in the history
match new changes with docker
apply markdownlint rules
  • Loading branch information
CHashtager committed Mar 29, 2024
1 parent 84dcfb3 commit 9e6d4fa
Showing 1 changed file with 62 additions and 13 deletions.
75 changes: 62 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,45 +9,63 @@ Click [here](https://github.com/EngRobot33/ZED/blob/master/screenshots/Screensho
## Installation

* First of all clone the project:
```

```bash
git clone https://github.com/EngRobot33/ZED.git
```

* Then, we need a virtual environment you can create like this:
```

```bash
virtualenv venv
```

* Activate it with the command below:
```

```bash
source venv/bin/activate
```

* After that, you must install all the packages in `requirements.txt` file in project directory:
```

```bash
pip install -r requirements.txt
```

* You should install PostgreSQL and its dependecies:

```shell
sudo apt update
sudo apt install python3-pip python3-dev libpq-dev postgresql postgresql-contrib
```

* Now setup your database in PostgreSQL shell:
* Open PostgreSQL shell:

```shell
sudo -u postgres psql
```

* Create database:

```sql
CREATE DATABASE <database_name>;
```

* Create user:

```sql
CREATE USER <database_user> WITH PASSWORD '<database_password>';
```

* Grant all privileges to zed database user:

```sql
GRANT ALL PRIVILEGES ON DATABASE <database_name> TO <database_user>;
```

* Create a `.env` file in root directory and add your created config like `.env.sample`:

```python
SECRET_KEY = 'Your secret key generated by https://djecrety.ir'
DEBUG = 'Project debug status'
Expand All @@ -59,43 +77,74 @@ DB_PASS = '<database_password>'
DB_HOST = '<database_host>'
DB_PORT = '<database_port>'
```

* After that, migration:
```

```bash
python3 manage.py migrate
```

* Then make sure that Redis is actually running on your machine:
```

```bash
redis-server
```

* Now you should install all the packages in `package.json` file. Just make sure npm is installed:
```

```bash
npm install
```

* That's finished! Now you can run the project:
```
```bash
python3 manage.py runserver
```
## Run with docker
* You need to [install docker](https://docs.docker.com/get-docker/)
* Then clone the project:
```
```bash
git clone https://github.com/EngRobot33/ZED.git
```
* Create a `.env` file in root directory and add your created config like `.env.sample`:
```python
SECRET_KEY = 'Your secret key generated by https://djecrety.ir'
DEBUG = 'Project debug status'
ALLOWED_HOSTS = 'Host/Domain names list that this site can serve for e.g ['*'] allows all hosts'
DB_NAME = '<database_name>'
DB_USER = '<database_user>'
DB_PASS = '<database_password>'
DB_HOST = db
DB_PORT = <database_port>
```
* That's finished! Now you can run the project:
* Make sure to match the database environment variables in `docker-compose.yml` too and create the database as mentioned before.
```yml
environment:
- POSTGRES_USER=zed_user
- POSTGRES_PASSWORD=zed_password
- POSTGRES_DB=zed_database
#
#
ports:
- "5432:5432"
```
* That's finished! Now you can run the project:

```bash
docker compose up -d
```

## Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

0 comments on commit 9e6d4fa

Please sign in to comment.