mirror of
https://git.kotyczka.ch/developers/django.git
synced 2025-04-05 15:25:08 +02:00
demo app dockerized
This commit is contained in:
parent
6d3b7d1a0a
commit
87ab4d5578
2
.gitignore
vendored
2
.gitignore
vendored
@ -1 +1 @@
|
||||
env
|
||||
virtualenv
|
||||
|
19
Dockerfile
Executable file
19
Dockerfile
Executable file
@ -0,0 +1,19 @@
|
||||
# Dockerfile
|
||||
|
||||
# The first instruction is what image we want to base our container on
|
||||
# We Use an official Python runtime as a parent image
|
||||
FROM python:3.11-bookworm
|
||||
|
||||
# Allows docker to cache installed dependencies between builds
|
||||
COPY requirements.txt requirements.txt
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
# Mounts the application code to the image
|
||||
COPY ./demo /app
|
||||
WORKDIR /app
|
||||
|
||||
EXPOSE 8000
|
||||
|
||||
# runs the production server
|
||||
ENTRYPOINT ["python3", "manage.py"]
|
||||
CMD ["runserver", "0.0.0.0:8000"]
|
@ -1,13 +1,21 @@
|
||||
-- Tutorial of django
|
||||
https://duckduckgo.com/?q=django+tutorial&iax=videos&ia=videos&iai=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dsm1mokevMWk
|
||||
|
||||
python3 -m venv env
|
||||
-- Make a root folder named xy
|
||||
python3 -m venv virtualenv
|
||||
#### Activate the virutal environment
|
||||
source virtualenv/bin/activate
|
||||
#### Install django
|
||||
python3 -m pip install django
|
||||
## Start the project
|
||||
django-admin startproject demo
|
||||
## install an app
|
||||
python3 manage.py startapp migration
|
||||
|
||||
-- Django calling Rest Services ?
|
||||
|
||||
python3 manage.py newproject demo
|
||||
django-admin startproject demo
|
||||
python3 manage.py startapp banking
|
||||
|
||||
|
||||
python3 manage.py runserver
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
demo/db.sqlite3
BIN
demo/db.sqlite3
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -20,7 +20,7 @@ BASE_DIR = Path(__file__).resolve().parent.parent
|
||||
# See https://docs.djangoproject.com/en/5.0/howto/deployment/checklist/
|
||||
|
||||
# SECURITY WARNING: keep the secret key used in production secret!
|
||||
SECRET_KEY = 'django-insecure-$u*_j$i$smmznp+huzp09!%=y71)uet6=va4l^4g#e+*_3+orv'
|
||||
SECRET_KEY = 'django-insecure-z$@7i%n)hn)=5-c8!%)y1-493jkohy8=s-xq8=iu(aud)xx0_+'
|
||||
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = True
|
||||
@ -37,7 +37,7 @@ INSTALLED_APPS = [
|
||||
'django.contrib.sessions',
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
'banking'
|
||||
'migration',
|
||||
]
|
||||
|
||||
MIDDLEWARE = [
|
||||
|
@ -16,11 +16,10 @@ Including another URLconf
|
||||
"""
|
||||
from django.contrib import admin
|
||||
from django.urls import path,include
|
||||
from banking.views import migration_home
|
||||
from migration.views import migration_home
|
||||
|
||||
urlpatterns = [
|
||||
path('admin/', admin.site.urls),
|
||||
path('', include("banking.urls")),
|
||||
path('migration/', migration_home)
|
||||
,
|
||||
path('', include("migration.urls")),
|
||||
path('migration/', migration_home),
|
||||
]
|
||||
|
BIN
demo/migration/__pycache__/__init__.cpython-311.pyc
Normal file
BIN
demo/migration/__pycache__/__init__.cpython-311.pyc
Normal file
Binary file not shown.
BIN
demo/migration/__pycache__/admin.cpython-311.pyc
Normal file
BIN
demo/migration/__pycache__/admin.cpython-311.pyc
Normal file
Binary file not shown.
BIN
demo/migration/__pycache__/apps.cpython-311.pyc
Normal file
BIN
demo/migration/__pycache__/apps.cpython-311.pyc
Normal file
Binary file not shown.
BIN
demo/migration/__pycache__/models.cpython-311.pyc
Normal file
BIN
demo/migration/__pycache__/models.cpython-311.pyc
Normal file
Binary file not shown.
BIN
demo/migration/__pycache__/urls.cpython-311.pyc
Normal file
BIN
demo/migration/__pycache__/urls.cpython-311.pyc
Normal file
Binary file not shown.
Binary file not shown.
@ -1,6 +1,6 @@
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class BankingConfig(AppConfig):
|
||||
class MigrationConfig(AppConfig):
|
||||
default_auto_field = 'django.db.models.BigAutoField'
|
||||
name = 'banking'
|
||||
name = 'migration'
|
BIN
demo/migration/migrations/__pycache__/__init__.cpython-311.pyc
Normal file
BIN
demo/migration/migrations/__pycache__/__init__.cpython-311.pyc
Normal file
Binary file not shown.
1
demo/starter/build.sh
Executable file
1
demo/starter/build.sh
Executable file
@ -0,0 +1 @@
|
||||
docker build -t docker.kotyczka.ch/django-app:latest .
|
15
docker-compose.yml
Normal file
15
docker-compose.yml
Normal file
@ -0,0 +1,15 @@
|
||||
version: '3'
|
||||
services:
|
||||
django:
|
||||
container_name: demo
|
||||
image: docker.kotyczka.ch/django-app:latest
|
||||
build:
|
||||
context: .
|
||||
ports:
|
||||
- "9000:8000"
|
||||
networks:
|
||||
- ametiq
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
ametiq:
|
||||
external: true
|
1
requirements.txt
Normal file
1
requirements.txt
Normal file
@ -0,0 +1 @@
|
||||
Django==5.0.1
|
1
start_composer.sh
Executable file
1
start_composer.sh
Executable file
@ -0,0 +1 @@
|
||||
docker-compose up -d
|
2
stop_composer.sh
Executable file
2
stop_composer.sh
Executable file
@ -0,0 +1,2 @@
|
||||
docker-compose down -v
|
||||
docker rmi docker.kotyczka.ch/django-app:latest
|
Loading…
x
Reference in New Issue
Block a user