Advertisement
Guest User

Untitled

a guest
Feb 27th, 2018
917
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.14 KB | None | 0 0
  1. GET http://localhost:8000/static/rest_framework/css/bootstrap.min.css net::ERR_ABORTED
  2. localhost/:20 GET http://localhost:8000/static/rest_framework/css/bootstrap-tweaks.css net::ERR_ABORTED
  3. localhost/:23 GET http://localhost:8000/static/rest_framework/css/prettify.css net::ERR_ABORTED
  4. localhost/:24 GET http://localhost:8000/static/rest_framework/css/default.css net::ERR_ABORTED
  5. (index):219 GET http://localhost:8000/static/rest_framework/js/ajax-form.js net::ERR_ABORTED
  6. (index):218 GET http://localhost:8000/static/rest_framework/js/jquery-1.12.4.min.js net::ERR_ABORTED
  7. (index):220 GET http://localhost:8000/static/rest_framework/js/csrf.js net::ERR_ABORTED
  8. (index):221 GET http://localhost:8000/static/rest_framework/js/bootstrap.min.js net::ERR_ABORTED
  9. (index):222 GET http://localhost:8000/static/rest_framework/js/prettify-min.js net::ERR_ABORTED
  10. (index):223 GET http://localhost:8000/static/rest_framework/js/default.js net::ERR_ABORTED
  11. (index):219 GET http://localhost:8000/static/rest_framework/js/ajax-form.js 404 (Not Found)
  12. (index):220 GET http://localhost:8000/static/rest_framework/js/csrf.js net::ERR_ABORTED
  13. (index):221 GET http://localhost:8000/static/rest_framework/js/bootstrap.min.js net::ERR_ABORTED
  14. (index):222 GET http://localhost:8000/static/rest_framework/js/prettify-min.js net::ERR_ABORTED
  15. (index):223 GET http://localhost:8000/static/rest_framework/js/default.js net::ERR_ABORTED
  16.  
  17. Django (1.11.1)
  18. django-rest-auth (0.9.2)
  19. djangorestframework (3.7.1)
  20.  
  21. os.environ.setdefault("DJANGO_SETTINGS_MODULE", "Qyun.settings")
  22.  
  23. #application = get_wsgi_application()
  24.  
  25. from socketio import Middleware
  26. from xxx.website_chat.views import sio
  27. django_app = get_wsgi_application()
  28. application = Middleware(sio, django_app)
  29.  
  30. import eventlet
  31. import eventlet.wsgi
  32. eventlet.wsgi.server(eventlet.listen(('', 8000)), application)
  33.  
  34. # -*- coding: utf-8 -*-
  35.  
  36. """
  37. Django settings for Qiyun02 project.
  38.  
  39. Generated by 'django-admin startproject' using Django 1.11.5.
  40.  
  41. For more information on this file, see
  42. https://docs.djangoproject.com/en/1.11/topics/settings/
  43.  
  44. For the full list of settings and their values, see
  45. https://docs.djangoproject.com/en/1.11/ref/settings/
  46. """
  47.  
  48. import os
  49. import sys
  50.  
  51. #import django.contrib.auth.middleware
  52.  
  53. # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
  54. BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
  55. PARENT_DIR = os.path.abspath(os.path.join(BASE_DIR, os.pardir))
  56.  
  57. # 增加sys目录
  58. sys.path.insert(0, BASE_DIR)
  59. sys.path.insert(0, os.path.join(PARENT_DIR,'旗云管理员后台'))
  60. sys.path.insert(0, os.path.join(PARENT_DIR,'用户前台'))
  61. sys.path.insert(0, os.path.join(PARENT_DIR,'用户管理后台'))
  62.  
  63.  
  64. # Quick-start development settings - unsuitable for production
  65. # See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/
  66.  
  67. # SECURITY WARNING: keep the secret key used in production secret!
  68. SECRET_KEY = 'u8ctyimjuy7t-7r3%$&4sc2g^5fhc8dathp8z&(7pp=&eee@zn'
  69.  
  70. # SECURITY WARNING: don't run with debug turned on in production!
  71. DEBUG = True
  72.  
  73. ALLOWED_HOSTS = ['*']
  74.  
  75.  
  76. # Application definition
  77.  
  78.  
  79. INSTALLED_APPS = [
  80.  
  81. 'django.contrib.admin',
  82. 'django.contrib.auth',
  83. 'django.contrib.contenttypes',
  84. 'django.contrib.sessions',
  85. 'django.contrib.messages',
  86. 'django.contrib.staticfiles',
  87. 'django.contrib.sites',
  88.  
  89. 'corsheaders', # 跨域头
  90.  
  91. 'rest_framework',
  92. 'rest_framework.authtoken',
  93. 'rest_framework_docs', # API文档
  94. 'rest_auth',
  95. 'allauth',
  96. 'allauth.account',
  97. 'allauth.socialaccount',
  98. 'rest_auth.registration',
  99.  
  100.  
  101. # apps
  102. ......
  103.  
  104. ]
  105.  
  106. SITE_ID = 1
  107.  
  108.  
  109. # email backend TODO
  110. EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
  111.  
  112. #EMAIL_USE_TLS = True
  113. EMAIL_USE_SSL = True
  114. EMAIL_HOST = 'smtp.gmail.com' # QQ:smtp.qq.com 163:smtp.163.com
  115. EMAIL_PORT = 465
  116. EMAIL_HOST_USER = 'qiyunserver@gmail.com'
  117. EMAIL_HOST_PASSWORD = 'qiyunserver123'
  118. DEFAULT_FROM_EMAIL = EMAIL_HOST_USER
  119.  
  120.  
  121. # TODO 方便调试,关闭Token验证
  122. REST_FRAMEWORK = {
  123. 'DEFAULT_PERMISSION_CLASSES':[], #'rest_framework.permissions.IsAuthenticated'
  124. 'DEFAULT_AUTHENTICATION_CLASSES':(
  125. 'rest_framework.authentication.TokenAuthentication',
  126. 'rest_framework.authentication.SessionAuthentication',
  127. ), #['rest_framework.authentication.TokenAuthentication'], # 'rest_framework.authentication.TokenAuthentication'
  128. #'DEFAULT_PAGINATION_CLASS': ('rest_framework.pagination.PageNumberPagination',), 不能打开这个
  129. #'PAGE_SIZE':10,
  130. }
  131.  
  132.  
  133. REST_AUTH_SERIALIZERS = {
  134. 'LOGIN_SERIALIZER': 'Qiyun02.common.Serializer.LoginSerializer',
  135. 'TOKEN_SERIALIZER': 'Qiyun02.common.Serializer.TokenSerializer',
  136. }
  137.  
  138.  
  139. MIDDLEWARE = [
  140. 'django.middleware.security.SecurityMiddleware',
  141. 'django.contrib.sessions.middleware.SessionMiddleware',
  142.  
  143. 'corsheaders.middleware.CorsMiddleware',
  144. 'django.middleware.common.CommonMiddleware',
  145.  
  146. 'django.middleware.csrf.CsrfViewMiddleware',
  147. 'corsheaders.middleware.CorsPostCsrfMiddleware',
  148.  
  149. 'django.contrib.auth.middleware.AuthenticationMiddleware',
  150. 'django.contrib.messages.middleware.MessageMiddleware',
  151. 'django.middleware.clickjacking.XFrameOptionsMiddleware',
  152.  
  153. 'Qiyun02.middlewares.AccessControlMiddleware.AccessControl', # access-control中间件
  154.  
  155. ]
  156.  
  157. # TODO: 发布时候去掉
  158. CORS_ALLOW_METHODS = [
  159. 'DELETE',
  160. 'GET',
  161. 'OPTIONS',
  162. 'PATCH',
  163. 'POST',
  164. 'PUT',
  165. ]
  166.  
  167. # TODO: 发布时候去掉
  168. CORS_ALLOW_HEADERS = (
  169. 'XMLHttpRequest',
  170. 'X_FILENAME',
  171. 'accept-encoding',
  172. 'accept',
  173. 'accept-encoding',
  174. 'authorization',
  175. 'content-type',
  176. 'dnt',
  177. 'origin',
  178. 'user-agent',
  179. 'x-csrftoken',
  180. 'x-requested-with',
  181. )
  182. # TODO: 发布时候去掉
  183. CORS_ORIGIN_ALLOW_ALL = False
  184.  
  185. CORS_ALLOW_CREDENTIALS = True
  186.  
  187. CORS_ORIGIN_WHITELIST = (
  188.  
  189. 'http://10.10.10.102:8081',
  190. 'http://10.10.10.103:8000',
  191. 'http://10.10.10.103:8080',
  192. 'http://10.10.10.105:8000',
  193. 'http://10.10.10.105:8001',
  194. 'http://10.10.10.105:8080',
  195.  
  196. 'http://0.0.0.0:8000',
  197. 'http://0.0.0.0:8001',
  198. 'http://0.0.0.0:8080',
  199.  
  200. 'http://localhost:8081',
  201. 'http://localhost',
  202. )
  203.  
  204. ######
  205.  
  206. ROOT_URLCONF = 'Qiyun02.urls'
  207.  
  208. TEMPLATES = [
  209. {
  210. 'BACKEND': 'django.template.backends.django.DjangoTemplates',
  211. 'DIRS': [os.path.join(BASE_DIR, 'templates')]
  212. ,
  213. 'APP_DIRS': True,
  214. 'OPTIONS': {
  215. 'context_processors': [
  216. 'django.template.context_processors.debug',
  217. 'django.template.context_processors.request',
  218. 'django.contrib.auth.context_processors.auth',
  219. 'django.contrib.messages.context_processors.messages',
  220. ],
  221. },
  222. },
  223. ]
  224.  
  225. WSGI_APPLICATION = 'Qiyun02.wsgi.application'
  226.  
  227.  
  228. # Database
  229. # https://docs.djangoproject.com/en/1.11/ref/settings/#databases
  230.  
  231. DATABASES = {
  232. 'default': {
  233. 'ENGINE': 'django.db.backends.mysql',
  234. 'NAME': 'qiyun02',
  235. 'USER':'root',
  236. 'PASSWORD':'devops',
  237. 'HOST':'127.0.0.1',
  238. 'PORT':'3306',
  239. }
  240. }
  241.  
  242.  
  243. # Password validation
  244. # https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators
  245.  
  246. AUTH_PASSWORD_VALIDATORS = [
  247. {
  248. 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
  249. },
  250. {
  251. 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
  252. },
  253. {
  254. 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
  255. },
  256. {
  257. 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
  258. },
  259. ]
  260.  
  261.  
  262. # Internationalization
  263. # https://docs.djangoproject.com/en/1.11/topics/i18n/
  264.  
  265. LANGUAGE_CODE = 'zh-cn' # 'en-us'
  266.  
  267. TIME_ZONE = 'Asia/Shanghai'
  268.  
  269. USE_I18N = True
  270.  
  271. USE_L10N = True
  272.  
  273. USE_TZ = True
  274.  
  275.  
  276. # Static files (CSS, JavaScript, Images)
  277. # https://docs.djangoproject.com/en/1.11/howto/static-files/
  278.  
  279.  
  280. STATIC_URL = '/static/'
  281. STATICFILES_DIRS = (
  282. os.path.join(BASE_DIR, 'static'),
  283. )
  284.  
  285. MEDIA_URL = '/media/'
  286. MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
  287.  
  288. STATIC_ROOT = BASE_DIR + '/static/'
  289. STATIC_URL = '/static/'
  290. STATICFILES_DIRS = (
  291. os.path.join(BASE_DIR, 'static'),
  292. )
  293.  
  294. import os
  295.  
  296. from django.core.wsgi import get_wsgi_application
  297.  
  298. os.environ.setdefault("DJANGO_SETTINGS_MODULE", "Qiyun02.settings")
  299.  
  300. application = get_wsgi_application()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement