测试 docker 运行
This commit is contained in:
9
Dockerfile
Normal file
9
Dockerfile
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
FROM python:2.7
|
||||||
|
ENV PYTHONUNBUFFERED 1
|
||||||
|
EVN oj_env daocloud
|
||||||
|
RUN mkdir /var/oj
|
||||||
|
COPY . /var/oj/
|
||||||
|
WORKDIR /var/oj/
|
||||||
|
RUN pip install -r requirements.txt
|
||||||
|
EXPOSE: 8080
|
||||||
|
RUN python manage,py runserver 8080
|
||||||
1
Procfile
1
Procfile
@@ -1 +0,0 @@
|
|||||||
web: gunicorn oj.wsgi:application -b $VCAP_APP_HOST:$VCAP_APP_PORT
|
|
||||||
19
oj/daocloud_settings.py
Normal file
19
oj/daocloud_settings.py
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
# coding=utf-8
|
||||||
|
import os
|
||||||
|
|
||||||
|
LOG_PATH = "LOG/"
|
||||||
|
|
||||||
|
# Database
|
||||||
|
# https://docs.djangoproject.com/en/1.8/ref/settings/#databases
|
||||||
|
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||||
|
|
||||||
|
DATABASES = {
|
||||||
|
'default': {
|
||||||
|
'ENGINE': 'django.db.backends.sqlite3',
|
||||||
|
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
|
||||||
|
'CONN_MAX_AGE': 1,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# SECURITY WARNING: don't run with debug turned on in production!
|
||||||
|
DEBUG = True
|
||||||
@@ -15,12 +15,14 @@ https://docs.djangoproject.com/en/1.8/ref/settings/
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
# todo 判断运行环境
|
# todo 判断运行环境
|
||||||
ENV = "local"
|
ENV = os.environ.get("oj_env", "local")
|
||||||
|
|
||||||
if ENV == "local":
|
if ENV == "local":
|
||||||
from .local_settings import *
|
from .local_settings import *
|
||||||
else:
|
elif ENV == "server":
|
||||||
from .server_settings import *
|
from .server_settings import *
|
||||||
|
elif ENV == "daocloud":
|
||||||
|
from .daocloud_settings import *
|
||||||
|
|
||||||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user