git clone https://github.com/dev-KPI/iatp-dev-website-backend-python.gitTo use this project without installation of everything by yourself just use
pip3 install -r requirements.txtCreate 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 makemigrationsRun the command in the directory with file manage.py
python manage.py migrateRun the command in the directory with file manage.py. Follow the instructions
python manage.py createsuperuserRun the command in the directory with file manage.py
python manage.py runserverFlyctl 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 | shIf itโs your first time using Fly.io, youโll need to sign up for an account.
flyctl auth signupTo 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 launchSo 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