Loyihani o'z kompyuteringizga yuklab olish uchun quyidagi qadamlarni bajaring:
-
Git repositoryni klon qiling:
git clone <repository_url> cd <repository_name>
-
.env
file yarating. misol tariqasida.env.example
filedan ko'ring yoki:cp .env.example .env
-
Komputeringizga
python
,docker
o'rnatib oling va:python3 -m venv venv # agar sizda virtualenv bolsa virtualenv venv
-
venv
fileingizni ishga tushuring:source venv/bin/activate
-
kerakli kutubxonalarni o'z komputeringizga o'rnating. Bu sizga localda ishlayotganingizda yordam beradi:
pip install -r requirements.txt
-
Dockerni ishga tushuring. Ish tushurishda bir narsaga etibor bering
.env
file ichidaPIPELINE
o'zgaruvchisi bor shuni localda ishlayotganingizdadev
qilib olishni unutmang!!!:docker compose up --build # yoki docker-compose up --build
dasturni online komputerga yani serverga deploy qilish uchun quyidagi qadamlar mavjud.
- Loyihani serverga clone qilib oling (buni teparoqda ko'rsatib ketdim).
- Serverni yangilab oling:
sudo apt update & sudo apt upgrade
- Serverga kerakli texnologyalarni o'rnatish:
# dockerni o'rnatish sudo apt install docker.io # Python 3 o'rnatish sudo apt install python3 python3-pip # Nginx o'rnatish sudo apt install nginx # Gunicorn o'rnatish (Python uchun) sudo apt install gunicorn
- kegin tepada ko'rsatganimdek: loyiha papka ichiga kirib olasiz, virtual muxit yaratasiz (buni ham tepada misol ko'rsatib qoydim),
.env
file yaratasiz.env.example
misolida ichidagi ma'lumotlarni o'zingizga moslab olasiz, so'ng loyihani serverda ishga tushurasiz. - serverda loyihani ishga tushurish
docker compose -f docker-compose-production.yml up --build # yoki docker-compose -f docker-compose-production.yml up --build
- Qanday qilib superuser yarata olaman?
docker compose run web python manage.py createsuperuser
- docker compose run web dan kegin python commandalaridan foydalana olasiz.
- Qanday qilib docker container ichiga kira olaman?
docker ps # sizga kontainerlar ro'yixati ko'rinadi ular ichidan siz web ni tanlab uni container id sini kiritasiz, yani: docker exec -it containerID bash
- CI/CD pipline with github action
- auto testing project