· 9 years ago · Nov 01, 2016, 07:02 PM
1"""
2Django settings for POS project.
3
4Generated by 'django-admin startproject' using Django 1.10.2.
5
6For more information on this file, see
7https://docs.djangoproject.com/en/1.10/topics/settings/
8
9For the full list of settings and their values, see
10https://docs.djangoproject.com/en/1.10/ref/settings/
11"""
12
13import os
14
15# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
16BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
17
18
19# Quick-start development settings - unsuitable for production
20# See https://docs.djangoproject.com/en/1.10/howto/deployment/checklist/
21
22# SECURITY WARNING: keep the secret key used in production secret!
23SECRET_KEY = 'p9x-qu^k7yl259yjo+qu+p^s#_(#rq*5^0$)2$edw@ng7urz$d'
24
25# SECURITY WARNING: don't run with debug turned on in production!
26DEBUG = True
27
28ALLOWED_HOSTS = []
29
30
31# Application definition
32
33INSTALLED_APPS = [
34 #'django.contrib.admin',
35 'django.contrib.auth',
36 'django.contrib.contenttypes',
37 #'django.contrib.sessions',
38 #'django.contrib.messages',
39 'django.contrib.staticfiles',
40 'rest_framework',
41 'rest_framework_mongoengine',
42 'users',
43 'testing',
44]
45
46MIDDLEWARE = [
47 'django.middleware.security.SecurityMiddleware',
48 'django.contrib.sessions.middleware.SessionMiddleware',
49 'django.middleware.common.CommonMiddleware',
50 'django.middleware.csrf.CsrfViewMiddleware',
51 'django.contrib.auth.middleware.AuthenticationMiddleware',
52 'django.contrib.messages.middleware.MessageMiddleware',
53 'django.middleware.clickjacking.XFrameOptionsMiddleware',
54]
55
56ROOT_URLCONF = 'POS.urls'
57
58TEMPLATES = [
59 {
60 'BACKEND': 'django.template.backends.django.DjangoTemplates',
61 'DIRS': [],
62 'APP_DIRS': True,
63 'OPTIONS': {
64 'context_processors': [
65 'django.template.context_processors.debug',
66 'django.template.context_processors.request',
67 'django.contrib.auth.context_processors.auth',
68 'django.contrib.messages.context_processors.messages',
69 ],
70 },
71 },
72]
73
74
75
76
77# Database
78# https://docs.djangoproject.com/en/1.10/ref/settings/#databases
79
80#DATABASES = {
81# 'default': {
82# 'ENGINE': 'django.db.backends.sqlite3',
83# 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
84# }
85#}
86
87WSGI_APPLICATION = 'POS.wsgi.application'
88
89
90import mongoengine
91
92DATABASES = {
93 'default': {
94 'ENGINE': '',
95 },
96
97}
98
99#SESSION_ENGINE = 'mongoengine.django.sessions' # optional
100_MONGODB_USER = ''
101_MONGODB_PASSWD = ''
102_MONGODB_HOST = '127.0.0.1:52319'
103_MONGODB_NAME = 'my_database'
104_MONGODB_DATABASE_HOST = \
105 'mongodb://%s:%s@%s/%s' \
106 % (_MONGODB_USER, _MONGODB_PASSWD, _MONGODB_HOST, _MONGODB_NAME)
107
108
109mongoengine.connect(_MONGODB_NAME)
110#mongoengine.connect(_MONGODB_NAME, host=_MONGODB_DATABASE_HOST)
111
112
113
114
115# Password validation
116# https://docs.djangoproject.com/en/1.10/ref/settings/#auth-password-validators
117
118AUTH_PASSWORD_VALIDATORS = [
119 {
120 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
121 },
122 {
123 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
124 },
125 {
126 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
127 },
128 {
129 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
130 },
131]
132
133REST_FRAMEWORK = {
134 # Use Django's standard `django.contrib.auth` permissions,
135 # or allow read-only access for unauthenticated users.
136 'DEFAULT_PERMISSION_CLASSES': [
137 'rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly'
138 ]
139}
140
141# Internationalization
142# https://docs.djangoproject.com/en/1.10/topics/i18n/
143
144LANGUAGE_CODE = 'en-us'
145
146TIME_ZONE = 'UTC'
147
148USE_I18N = True
149
150USE_L10N = True
151
152USE_TZ = True
153
154
155# Static files (CSS, JavaScript, Images)
156# https://docs.djangoproject.com/en/1.10/howto/static-files/
157
158STATIC_URL = '/static/'