· 7 years ago · Jul 21, 2018, 10:20 AM
1"""
2Django settings for calculator project.
3
4Generated by 'django-admin startproject' using Django 2.0.2.
5
6For more information on this file, see
7https://docs.djangoproject.com/en/2.0/topics/settings/
8
9For the full list of settings and their values, see
10https://docs.djangoproject.com/en/2.0/ref/settings/
11"""
12
13import os
14
15DBDNAME='mydata'
16_MONGODB_HOST='localhost'
17_MONGODB_NAME='mydata'
18_MONGODB_DATABASE_HOST =
19 'mongodb://%s:%s@%s/%s'
20 %('','',_MONGODB_HOST,_MONGODB_NAME)
21# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
22BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
23TEMPLATES_DIR = os.path.join(BASE_DIR,'templates')
24
25
26# Quick-start development settings - unsuitable for production
27# See https://docs.djangoproject.com/en/2.0/howto/deployment/checklist/
28
29# SECURITY WARNING: keep the secret key used in production secret!
30SECRET_KEY = '3gcc++w$zhw7k=4&)po*r4_sqc_u7vhbqt0vpdsx(&-#ob#taj'
31
32# SECURITY WARNING: don't run with debug turned on in production!
33DEBUG = True
34
35ALLOWED_HOSTS = []
36
37
38# Application definition
39
40INSTALLED_APPS = [
41 'calc.apps.CalcConfig',
42 'django.contrib.admin',
43 'django.contrib.auth',
44 'django.contrib.contenttypes',
45 'django.contrib.sessions',
46 'django.contrib.messages',
47 'django.contrib.staticfiles',
48]
49
50MIDDLEWARE = [
51 'django.middleware.security.SecurityMiddleware',
52 'django.contrib.sessions.middleware.SessionMiddleware',
53 'django.middleware.common.CommonMiddleware',
54 'django.middleware.csrf.CsrfViewMiddleware',
55 'django.contrib.auth.middleware.AuthenticationMiddleware',
56 'django.contrib.messages.middleware.MessageMiddleware',
57 'django.middleware.clickjacking.XFrameOptionsMiddleware',
58]
59
60ROOT_URLCONF = 'calculator.urls'
61
62TEMPLATES = [
63 {
64 'BACKEND': 'django.template.backends.django.DjangoTemplates',
65 'DIRS': [TEMPLATES_DIR],
66 'APP_DIRS': True,
67 'OPTIONS': {
68 'context_processors': [
69 'django.template.context_processors.debug',
70 'django.template.context_processors.request',
71 'django.contrib.auth.context_processors.auth',
72 'django.contrib.messages.context_processors.messages',
73 ],
74 },
75 },
76]
77
78WSGI_APPLICATION = 'calculator.wsgi.application'
79
80
81# Database
82# https://docs.djangoproject.com/en/2.0/ref/settings/#databases
83
84DATABASES = {
85 'default': {
86 'ENGINE': '',
87 'NAME': '',
88 }
89}
90
91DBNAME='mydata'
92_MONGODB_USER_=''
93
94
95# Password validation
96# https://docs.djangoproject.com/en/2.0/ref/settings/#auth-password-validators
97
98AUTH_PASSWORD_VALIDATORS = [
99 {
100 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
101 },
102 {
103 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
104 },
105 {
106 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
107 },
108 {
109 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
110 },
111]
112
113
114# Internationalization
115# https://docs.djangoproject.com/en/2.0/topics/i18n/
116
117LANGUAGE_CODE = 'en-us'
118
119TIME_ZONE = 'UTC'
120
121USE_I18N = True
122
123USE_L10N = True
124
125USE_TZ = True
126
127
128# Static files (CSS, JavaScript, Images)
129# https://docs.djangoproject.com/en/2.0/howto/static-files/
130
131STATIC_URL = '/static/'
132
133from mongoengine import *
134from calculator.settings import DBNAME
135# Create your models here.
136
137connect(DBNAME)
138
139class information(Document):
140 number1 = StringField(max_length=120)
141 number2 = StringField(max_length=120)
142 values = StringField(max_length=120)
143 Result = StringField(max_length=120)