git clone https://github.com/dev-KPI/iatp-dev-website-backend-python.git
To use this project without installation of everything by yourself just use
pip3 install -r requirements.txt
Create your database. And make changes to the settings
sudo -u postgres psql
CREATE DATABASE my_database;
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. And make changes to the settings
https://djecrety.ir/
SECRET_KEY = os.getenv("SECRET_KEY")
SECRET_KEY = "<generated secret key>"
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
Run the command in the directory with file manage.py
python manage.py migrate
Run the command in the directory with file manage.py. Follow the instructions
python manage.py createsuperuser
Run the command in the directory with file manage.py
python manage.py runserver
Flyctl is a command-line utility that lets you work with the Fly.io platform, from creating your account to deploying your applications
curl -L https://fly.io/install.sh | sh
If it’s your first time using Fly.io, you’ll need to sign up for an account.
flyctl auth signup
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.
flyctl launch
So for the deployment steps all we need to do is put our .env files into fly instance and then issue a deploy command.
flyctl secrets import < .env
flyctl deploy