diff --git a/README.md b/README.md index 46c6560..0dad249 100644 --- a/README.md +++ b/README.md @@ -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 ; ``` + * Create user: + ```sql CREATE USER WITH PASSWORD ''; ``` + * Grant all privileges to zed database user: + ```sql GRANT ALL PRIVILEGES ON DATABASE TO ; ``` * 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' @@ -59,43 +77,74 @@ DB_PASS = '' DB_HOST = '' DB_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 = '' +DB_USER = '' +DB_PASS = '' +DB_HOST = db +DB_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.