Skip to content

Commit 28dfccc

Browse files
committed
dev: first commit
1 parent e5463ab commit 28dfccc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+10694
-0
lines changed

.editorconfig

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# top-most EditorConfig file
2+
root = true
3+
4+
# Unix-style newlines with a newline ending every file
5+
[*]
6+
charset = utf-8
7+
end_of_line = lf
8+
insert_final_newline = true
9+
tab_width = 4
10+
11+
# 4 spaces indentation
12+
[*.py]
13+
indent_style = space
14+
indent_size = 4
15+
16+
# tab indentation
17+
[Makefile]
18+
indent_style = tab
19+
20+
# indentation override for all JS files under lib directory
21+
[lib/**.js]
22+
indent_style = space
23+
indent_size = 2
24+
25+
# matches with json and yaml files
26+
[*.{json,yml}]
27+
indent_style = space
28+
indent_size = 2

.env.dist

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
DEBUG=True
2+
ALLOWED_HOSTS='CHANGE_IT.DOMAIN_NAME'
3+
CSRF_TRUSTED_ORIGINS='https://CHANGE_IT.DOMAIN_NAME'
4+
SECRET_KEY=CHANGE_IT_SECRET_KEY
5+
STATICFILES_DIRS='static'
6+
7+
POSTGRES_HOST=CHANGE_IT_DB_HOST
8+
POSTGRES_PORT=CHANGE_IT_DB_PORT
9+
POSTGRES_USER=CHANGE_IT_DB_USER
10+
POSTGRES_PASSWORD=CHANGE_IT_DB_PASSWORD
11+
POSTGRES_DB=CHANGE_IT_DB_NAME

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Vi
2+
*.*.swp
3+
14
# Byte-compiled / optimized / DLL files
25
__pycache__/
36
*.py[cod]

Makefile

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!make
2+
include .env
3+
4+
# HELP
5+
.PHONY: help
6+
7+
help: ## This help.
8+
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
9+
10+
.DEFAULT_GOAL := help
11+
12+
gen-pass: ## Generate an encrypt password from prompt
13+
@clear
14+
@./tools/system/gen_encrypt_password.sh
15+
16+
build: ## Build images
17+
@docker compose build
18+
up: ## Start containers stack (dettached)
19+
@docker compose up -d
20+
down: ## Stop containers stack
21+
@docker compose down
22+
destroy: ## Stop containers stack and remove volumes
23+
@docker compose down -v
24+
ps: ## List all container
25+
@docker container ps -a
26+
27+
login-db: ## login on web container
28+
@docker compose exec -it db bash
29+
login-nginx: ## login on nginx container
30+
@docker compose exec -it nginx bash
31+
32+
runserver: ## run django project localy
33+
@cd ./src ; python manage.py runserver

docker-compose.yml

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
version: '3.8'
2+
3+
services:
4+
# Architecture
5+
nginx:
6+
image: nginx:bookworm
7+
network_mode: host
8+
restart: unless-stopped
9+
volumes:
10+
- './docker/nginx/etc/nginx/nginx.conf:/etc/nginx/nginx.conf'
11+
- './docker/nginx/etc/nginx/conf.d/default.conf:/etc/nginx/conf.d/default.conf'
12+
13+
ngrok:
14+
image: ngrok/ngrok:debian
15+
network_mode: host
16+
restart: unless-stopped
17+
command:
18+
- 'start'
19+
- '--all'
20+
- '--config'
21+
- '/etc/authtoken.yml'
22+
- '--config'
23+
- '/etc/ngrok.yml'
24+
- '--log'
25+
- 'stdout'
26+
volumes:
27+
- './docker/ngrok/etc/authtoken.yml:/etc/authtoken.yml'
28+
- './docker/ngrok/etc/ngrok.yml:/etc/ngrok.yml'
29+
30+
db:
31+
image: postgres:15.3-bookworm
32+
network_mode: host
33+
restart: unless-stopped
34+
environment:
35+
- POSTGRES_HOST=${POSTGRES_HOST}
36+
- POSTGRES_PORT=${POSTGRES_PORT}
37+
- POSTGRES_USER=${POSTGRES_USER}
38+
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
39+
- POSTGRES_DB=${POSTGRES_DB}
40+
volumes:
41+
- db_data:/var/lib/postgresql/data
42+
43+
volumes:
44+
db_data:
45+
driver: local
+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
upstream mkdevs {
2+
server localhost:8000;
3+
}
4+
5+
server {
6+
listen 80;
7+
server_name mkdevs.eu.ngrok.io;
8+
9+
location / {
10+
proxy_pass http://mkdevs;
11+
proxy_read_timeout 300;
12+
proxy_set_header Host $host;
13+
proxy_set_header X-Forwarded-Host $server_name;
14+
proxy_set_header X-Real-IP $remote_addr;
15+
16+
add_header P3P 'CP="ALL DSP COR PSAa PSDa OUR NOR ONL UNI COM NAV"';
17+
add_header Access-Control-Allo-Origin '*';
18+
19+
access_log /var/log/nginx/mkdevs.access.log main;
20+
error_log /var/log/nginx/mkdevs.error.log warn;
21+
}
22+
}

docker/nginx/etc/nginx/nginx.conf

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
user nginx;
2+
worker_processes auto;
3+
4+
error_log /var/log/nginx/error.log notice;
5+
pid /var/run/nginx.pid;
6+
7+
events {
8+
worker_connections 1024;
9+
}
10+
11+
http {
12+
include /etc/nginx/mime.types;
13+
default_type application/octet-stream;
14+
15+
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
16+
'$status $body_bytes_sent "$http_referer" '
17+
'"$http_user_agent" "$http_x_forwarded_for"';
18+
19+
sendfile on;
20+
#tcp_nopush on;
21+
22+
keepalive_timeout 65;
23+
24+
#gzip on;
25+
26+
include /etc/nginx/conf.d/*.conf;
27+
}

docker/ngrok/etc/authtoken.yml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
version: 2
2+
region: eu
3+
4+
authtoken: 2P5ORQm6Rsv1dUZQTSzCa2ershG_6WnHHbkPkEYpdEPETTpGK

docker/ngrok/etc/ngrok.yml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
version: 2
2+
region: eu
3+
4+
tunnels:
5+
ssh:
6+
proto: tcp
7+
addr: 22
8+
remote_addr: 3.tcp.eu.ngrok.io:28700
9+
http:
10+
proto: http
11+
addr: 127.0.0.1:80
12+
hostname: mkdevs.eu.ngrok.io
13+
14+

src/about/__init__.py

Whitespace-only changes.

src/about/admin.py

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from django.contrib import admin
2+
3+
# Register your models here.

src/about/apps.py

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
from django.apps import AppConfig
2+
3+
4+
class AboutConfig(AppConfig):
5+
default_auto_field = 'django.db.models.BigAutoField'
6+
name = 'about'

src/about/migrations/__init__.py

Whitespace-only changes.

src/about/models.py

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from django.db import models
2+
3+
# Create your models here.

src/about/tests.py

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from django.test import TestCase
2+
3+
# Create your tests here.

src/about/urls.py

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
from django.urls import path
2+
from . import views
3+
4+
urlpatterns = [
5+
path('', views.index, name='about-index'),
6+
]

src/about/views.py

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from django.template.response import TemplateResponse
2+
from django.shortcuts import render
3+
4+
def index(request):
5+
return TemplateResponse(
6+
request, 'about/index.html', {
7+
'site_logo_name': 'mkdevs-logo',
8+
'site_name': 'mkdevs',
9+
'site_description': 'Let\'s brings your ideas and projects to life!',
10+
'page_title': 'About - mkdevs'
11+
}
12+
)
13+

src/contact/__init__.py

Whitespace-only changes.

src/contact/admin.py

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from django.contrib import admin
2+
3+
# Register your models here.

src/contact/apps.py

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
from django.apps import AppConfig
2+
3+
4+
class ContactConfig(AppConfig):
5+
default_auto_field = 'django.db.models.BigAutoField'
6+
name = 'contact'

src/contact/migrations/__init__.py

Whitespace-only changes.

src/contact/models.py

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from django.db import models
2+
3+
# Create your models here.

src/contact/tests.py

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from django.test import TestCase
2+
3+
# Create your tests here.

src/contact/urls.py

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
from django.urls import path
2+
from . import views
3+
4+
urlpatterns = [
5+
path('', views.index, name='contact-index'),
6+
]

src/contact/views.py

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from django.template.response import TemplateResponse
2+
from django.shortcuts import render
3+
4+
def index(request):
5+
return TemplateResponse(
6+
request, 'contact/index.html', {
7+
'site_logo_name': 'mkdevs-logo',
8+
'site_name': 'mkdevs',
9+
'site_description': 'Let\'s brings your ideas and projects to life!',
10+
'page_title': 'Contact - mkdevs'
11+
}
12+
)
13+

src/home/__init__.py

Whitespace-only changes.

src/home/admin.py

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from django.contrib import admin
2+
3+
# Register your models here.

src/home/apps.py

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
from django.apps import AppConfig
2+
3+
4+
class HomeConfig(AppConfig):
5+
default_auto_field = 'django.db.models.BigAutoField'
6+
name = 'home'

src/home/migrations/__init__.py

Whitespace-only changes.

src/home/models.py

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from django.db import models
2+
3+
# Create your models here.

src/home/tests.py

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from django.test import TestCase
2+
3+
# Create your tests here.

src/home/urls.py

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
from django.urls import path
2+
from . import views
3+
4+
urlpatterns = [
5+
path('', views.index, name='home-index'),
6+
]

src/home/views.py

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from django.template.response import TemplateResponse
2+
from django.shortcuts import render
3+
4+
def index(request):
5+
return TemplateResponse(
6+
request, 'home/index.html', {
7+
'site_logo_name': 'mkdevs-logo',
8+
'site_name': 'mkdevs',
9+
'site_description': 'Let\'s brings your ideas and projects to life!',
10+
'page_title': 'Home - mkdevs'
11+
}
12+
)
13+

src/manage.py

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env python
2+
"""Django's command-line utility for administrative tasks."""
3+
import os
4+
import sys
5+
6+
7+
def main():
8+
"""Run administrative tasks."""
9+
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mkdevs.settings')
10+
try:
11+
from django.core.management import execute_from_command_line
12+
except ImportError as exc:
13+
raise ImportError(
14+
"Couldn't import Django. Are you sure it's installed and "
15+
"available on your PYTHONPATH environment variable? Did you "
16+
"forget to activate a virtual environment?"
17+
) from exc
18+
execute_from_command_line(sys.argv)
19+
20+
21+
if __name__ == '__main__':
22+
main()

src/mkdevs/__init__.py

Whitespace-only changes.

src/mkdevs/asgi.py

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
"""
2+
ASGI config for mkdevs project.
3+
4+
It exposes the ASGI callable as a module-level variable named ``application``.
5+
6+
For more information on this file, see
7+
https://docs.djangoproject.com/en/4.2/howto/deployment/asgi/
8+
"""
9+
10+
import os
11+
12+
from django.core.asgi import get_asgi_application
13+
14+
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mkdevs.settings')
15+
16+
application = get_asgi_application()

0 commit comments

Comments
 (0)