Skip to content

Commit 3656ecc

Browse files
committed
first commit
0 parents  commit 3656ecc

File tree

154 files changed

+30576
-0
lines changed

Some content is hidden

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

154 files changed

+30576
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
env/
2+
__pycache__/

docker-compose.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
version: "3"
2+
3+
services:
4+
web:
5+
build: ./docker_django
6+
volumes:
7+
- ./docker_django:/var/www/html/mysite1
8+
ports:
9+
- 8000:8000
10+
expose:
11+
- "8000"
12+
depends_on:
13+
- db
14+
links:
15+
- "db:db"
16+
environment:
17+
- DEBUG=True
18+
restart: always
19+
20+
db:
21+
image: mysql:5.7
22+
environment:
23+
- MYSQL_ROOT_PASSWORD=123456
24+
- MYSQL_DATABASE=myproject
25+
- MYSQL_USER=dbuser
26+
- MYSQL_PASSWORD=password
27+
volumes:
28+
- ./volume_mysql:/var/lib/mysql:rw
29+
ports:
30+
- "3306:3306"
31+
restart: always
32+
33+
nginx:
34+
build: ./docker_others/nginx
35+
ports:
36+
- 80:80
37+
expose:
38+
- "80"
39+
volumes:
40+
- ./docker_django/static:/usr/share/nginx/html/static
41+
- ./docker_django/media:/usr/share/nginx/html/media
42+
- ./docker_others/nginx/ssl:/usr/share/nginx/ssl
43+
links:
44+
- "web:web"
45+
depends_on:
46+
- web
47+
restart: always

docker_django/.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
env/
2+
developing.md

docker_django/Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM python:3.6-alpine
2+
ENV INSTALL_PATH /var/www/html/mysite1
3+
COPY . /var/www/html/mysite1
4+
WORKDIR /var/www/html/mysite1
5+
RUN apk add python3-dev build-base linux-headers pcre-dev
6+
RUN apk update \
7+
&& apk add --virtual build-deps gcc python3-dev musl-dev \
8+
&& apk add --no-cache mariadb-dev
9+
RUN pip install -r requirements.txt
10+
RUN sed -i 's/\r//' ./start.sh
11+
RUN chmod +x ./start.sh
12+
CMD ["sh","./start.sh"]

docker_django/app_django/__init__.py

Whitespace-only changes.

docker_django/app_django/asgi.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
"""
2+
ASGI config for app_django 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/3.1/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', 'app_django.settings')
15+
16+
application = get_asgi_application()
Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
"""
2+
Django settings for app_django project.
3+
4+
Generated by 'django-admin startproject' using Django 3.1.3.
5+
6+
For more information on this file, see
7+
https://docs.djangoproject.com/en/3.1/topics/settings/
8+
9+
For the full list of settings and their values, see
10+
https://docs.djangoproject.com/en/3.1/ref/settings/
11+
"""
12+
13+
from pathlib import Path
14+
import os
15+
16+
# Build paths inside the project like this: BASE_DIR / 'subdir'.
17+
BASE_DIR = Path(__file__).resolve().parent.parent
18+
print("BASE_DIR=",BASE_DIR)
19+
20+
# Quick-start development settings - unsuitable for production
21+
# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/
22+
23+
# SECURITY WARNING: keep the secret key used in production secret!
24+
SECRET_KEY = '=y*knkg2_g*f^1q(#$_*m-x#$lmba#rqtwia+nkrsbz3sszhnh'
25+
26+
# SECURITY WARNING: don't run with debug turned on in production!
27+
DEBUG = True
28+
29+
ALLOWED_HOSTS = []
30+
31+
32+
# Application definition
33+
34+
INSTALLED_APPS = [
35+
'django.contrib.admin',
36+
'django.contrib.auth',
37+
'django.contrib.contenttypes',
38+
'django.contrib.sessions',
39+
'django.contrib.messages',
40+
'django.contrib.staticfiles',
41+
]
42+
43+
MIDDLEWARE = [
44+
'django.middleware.security.SecurityMiddleware',
45+
'django.contrib.sessions.middleware.SessionMiddleware',
46+
'django.middleware.common.CommonMiddleware',
47+
'django.middleware.csrf.CsrfViewMiddleware',
48+
'django.contrib.auth.middleware.AuthenticationMiddleware',
49+
'django.contrib.messages.middleware.MessageMiddleware',
50+
'django.middleware.clickjacking.XFrameOptionsMiddleware',
51+
]
52+
53+
ROOT_URLCONF = 'app_django.urls'
54+
55+
TEMPLATES = [
56+
{
57+
'BACKEND': 'django.template.backends.django.DjangoTemplates',
58+
'DIRS': [],
59+
'APP_DIRS': True,
60+
'OPTIONS': {
61+
'context_processors': [
62+
'django.template.context_processors.debug',
63+
'django.template.context_processors.request',
64+
'django.contrib.auth.context_processors.auth',
65+
'django.contrib.messages.context_processors.messages',
66+
],
67+
},
68+
},
69+
]
70+
71+
WSGI_APPLICATION = 'app_django.wsgi.application'
72+
73+
74+
# Database
75+
# https://docs.djangoproject.com/en/3.1/ref/settings/#databases
76+
77+
"""
78+
DATABASES = {
79+
'default': {
80+
'ENGINE': 'django.db.backends.sqlite3',
81+
'NAME': BASE_DIR / 'db.sqlite3',
82+
}
83+
}
84+
"""
85+
DATABASES = {
86+
'default': {
87+
'ENGINE': 'django.db.backends.mysql',
88+
'NAME': 'myproject',
89+
'USER':'dbuser',
90+
'PASSWORD':'password',
91+
'HOST': 'db',
92+
'PORT':'3306',
93+
}
94+
}
95+
96+
# Password validation
97+
# https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators
98+
99+
AUTH_PASSWORD_VALIDATORS = [
100+
{
101+
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
102+
},
103+
{
104+
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
105+
},
106+
{
107+
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
108+
},
109+
{
110+
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
111+
},
112+
]
113+
114+
115+
# Internationalization
116+
# https://docs.djangoproject.com/en/3.1/topics/i18n/
117+
118+
LANGUAGE_CODE = 'en-us'
119+
120+
TIME_ZONE = 'UTC'
121+
122+
USE_I18N = True
123+
124+
USE_L10N = True
125+
126+
USE_TZ = True
127+
128+
129+
# Static files (CSS, JavaScript, Images)
130+
# https://docs.djangoproject.com/en/3.1/howto/static-files/
131+
132+
STATIC_URL = '/static/'
133+
STATIC_ROOT = os.path.join(BASE_DIR,'static')
134+
135+
MEDIA_URL = '/media/'
136+
MEDIA_ROOT = os.path.join(BASE_DIR,'media')

docker_django/app_django/urls.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
"""app_django URL Configuration
2+
3+
The `urlpatterns` list routes URLs to views. For more information please see:
4+
https://docs.djangoproject.com/en/3.1/topics/http/urls/
5+
Examples:
6+
Function views
7+
1. Add an import: from my_app import views
8+
2. Add a URL to urlpatterns: path('', views.home, name='home')
9+
Class-based views
10+
1. Add an import: from other_app.views import Home
11+
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
12+
Including another URLconf
13+
1. Import the include() function: from django.urls import include, path
14+
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
15+
"""
16+
from django.contrib import admin
17+
from django.urls import path
18+
19+
urlpatterns = [
20+
path('admin/', admin.site.urls),
21+
]

docker_django/app_django/wsgi.py

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

docker_django/db.sqlite3

128 KB
Binary file not shown.

0 commit comments

Comments
 (0)