dev-KPI / iatp-dev-website-backend-python

First project. Landing website for our community. Backend part

Home Page:https://sitedive.fly.dev/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Project usage guide

How to run the project locally?

๐Ÿ’พ Downloading the project to the computer

Git clone

git clone https://github.com/dev-KPI/iatp-dev-website-backend-python.git

๐Ÿ”จ Dependency installation

To use this project without installation of everything by yourself just use

Libs installation

pip3 install -r requirements.txt

โšก๏ธ Connect your database

Create your database. And make changes to the settings

Connect to DB
sudo -u postgres psql 
Create DB
CREATE DATABASE my_database; 
Changes settings
DATABASES = {
    "default": {
        "ENGINE": "django.db.backends.postgresql",
        "NAME": "my_database",
        "USER": "<your user>",
        "PASSWORD": "<password 'your user'>",
        "HOST": "<localhost>",
        "PORT": "<port>",
    }
}

๐Ÿ” Get your secret key

Get your secret key. And make changes to the settings

Get your secret key
https://djecrety.ir/
Changes settings
Before
SECRET_KEY = os.getenv("SECRET_KEY")
After
SECRET_KEY = "<generated secret key>"

๐Ÿ—ƒ๏ธ Makemigrations

Run the command in the directory with file manage.py

Makemigrations writes model changes to separate migration files, similar to commits. Create makemigrations
python manage.py makemigrations

๐Ÿ—„๏ธ Migrate

Run the command in the directory with file manage.py

Migrate applies these changes to the database. Create migrate
python manage.py migrate

๐Ÿ‘‘ Superuser

Run the command in the directory with file manage.py. Follow the instructions

Create superuser
python manage.py createsuperuser

๐Ÿš€ Start

Run the command in the directory with file manage.py

Run project
python manage.py runserver

How to deploy a project remotely?

๐Ÿ’ฝ Install flyctl

Flyctl is a command-line utility that lets you work with the Fly.io platform, from creating your account to deploying your applications

Install flyctl
curl -L https://fly.io/install.sh | sh

๐Ÿ“– Sign up

If itโ€™s your first time using Fly.io, youโ€™ll need to sign up for an account.

Sign up
flyctl auth signup

๐Ÿ“ฎ Preparing Django application

To prepare for the fly.io you donโ€™t normally need anything. The fly.io cli will take care of everything. From creating the docker file to fly configuration file.

Preparing Django application
flyctl launch

๐Ÿš€ Deploy

So for the deployment steps all we need to do is put our .env files into fly instance and then issue a deploy command.

Deploy
flyctl secrets import < .env
flyctl deploy

About

First project. Landing website for our community. Backend part

https://sitedive.fly.dev/


Languages

Language:Python 100.0%