########################################### ######### Running the project ############# ###########################################
On terminal 1 cmd:
git clone xxx
cd docker_template/django
source venv/bin/activate
pip install -r requirements.txt
- Change debug to TRUE in settings.py in Django
python manage.py runserver
On terminal 2 cmd:
sudo systemctl enable rabbitmq-server
sudo systemctl start rabbitmq-server
sudo systemctl status rabbitmq-server
On terminal 3 cmd:
celery -A core worker -B -l INFO
(If you want to run both separately, the code iscelery -A core worker -l info --pool=solo
andcelery -A core beat -l info
)
On terminal 4 cmd:
python manage.py shell
from task1.tasks import add
add.delay(2,2)
On terminal 5 cmd:
cd docker_template/flask
source venv/bin/activate
pip install -r requirements.txt
flask run
On URL: http://127.0.0.1:8000/reviews - test send of email
On terminal 1 cmd:
git clone xxx
cd docker_template
- Change debug to FALSE in settings.py in the Django folder
docker-compose build
docker-compose up
On terminal 2 cmd:
docker exec -it django_container sh
python manage.py shell
from task1.tasks import add
add.delay(2,2)
On URL: http://127.0.0.1:8000/reviews - test send of email
########################################### ######### Building from scratch ########### ###########################################
##########################################
##########################################
mkdir docker_template
cd docker_template
- Create
docker-compose.yml
in this directory mkdir django_app
cd django_app
python3 -m venv venv
source venv/bin/activate
pip install django
(plus all the packages you need)django-admin startproject core .
pip freeze > requirements.txt
python manage.py runserver
- Create
Dockerfile
in this directory
###########################################
###########################################
cd docker_template/django
docker build --tag python-django1 .
docker run --publish 8000:8000 python-django1
docker exec -it fbdf9567f98a2cd08d2227fcfa787f2101dec138538941ead798b16614da20f5 /bin/bash
##########################################
##########################################
mkdir docker_template
cd docker_template
- Create
docker-compose.yml
in this directory mkdir flask_app
cd flask_app
python3 -m venv venv
source venv/bin/activate
pip install flask
(plus all the packages you need)pip freeze > requirements.txt
- Create
app.py
file with the necessary code python app.py
orflask run
- Create
Dockerfile
in this directory
##########################################
##########################################
cd docker_template/flask
docker build --tag python-flask1 .
docker run --publish 5000:5000 python-flask1
docker exec -it fbdf9567f98a2cd08d2227fcfa787f2101dec138538941ead798b16614da20f5 /bin/bash
##########################################
##########################################
cd docker_template
docker-compose build
docker-compose up
docker exec -it name_of_container sh
##########################################
##########################################
pip install psycopg2-binary
pip install celery
pip install django-celery-beat
pip install python-dotenv
pip install flower
pip install django-celery-results