Advertisement
Guest User

Untitled

a guest
Nov 16th, 2018
482
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 11.56 KB | None | 0 0
  1. #####################################
  2. ########## Django settings ##########
  3. #####################################
  4. # See <https://docs.djangoproject.com/en/1.11/ref/settings/>
  5. # for more info and help. If you are stuck, you can try Googling about
  6. # Django - many of these settings below have external documentation about them.
  7. #
  8. # The settings listed here are of special interest in configuring the site.
  9.  
  10. # SECURITY WARNING: keep the secret key used in production secret!
  11. # You may use <http://www.miniwebtool.com/django-secret-key-generator/>
  12. # to generate this key.
  13. SECRET_KEY = 'yesterdayhvfd7sghpor0)3eixv+67ro1_jft_i69oy!s81#cto2bl-nj-117'
  14.  
  15. # SECURITY WARNING: don't run with debug turned on in production!
  16. DEBUG = False  # Change to False once you are done with runserver testing.
  17.  
  18. # Uncomment and set to the domain names this site is intended to serve.
  19. # You must do this once you set DEBUG to False.
  20. #ALLOWED_HOSTS = ['dmoj.ca']
  21.  
  22. # Optional apps that DMOJ can make use of.
  23. INSTALLED_APPS += (
  24. )
  25.  
  26. # Caching. You can use memcached or redis instead.
  27. # Documentation: <https://docs.djangoproject.com/en/1.11/topics/cache/>
  28. CACHES = {
  29.     'default': {
  30.         'BACKEND': 'django.core.cache.backends.locmem.LocMemCache'
  31.     }
  32. }
  33.  
  34. # Your database credentials. Only MySQL is supported by DMOJ.
  35. # Documentation: <https://docs.djangoproject.com/en/1.11/ref/databases/>
  36. DATABASES = {
  37.      'default': {
  38.         'ENGINE': 'django.db.backends.mysql',
  39.         'NAME': 'dmoj',
  40.         'USER': 'dmoj',
  41.         'PASSWORD': 'qq1546923417',
  42.         'HOST': '127.0.0.1',
  43.         'OPTIONS': {
  44.             'charset': 'utf8mb4',
  45.             'sql_mode': 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION',
  46.         },
  47.     }
  48. }
  49.  
  50. # Sessions.
  51. # Documentation: <https://docs.djangoproject.com/en/1.11/topics/http/sessions/>
  52. #SESSION_ENGINE = 'django.contrib.sessions.backends.cached_db'
  53.  
  54. # Internationalization.
  55. # Documentation: <https://docs.djangoproject.com/en/1.11/topics/i18n/>
  56. LANGUAGE_CODE = 'zh-cn'
  57. DEFAULT_USER_TIME_ZONE = 'Asia/Shanghai'
  58. USE_I18N = True
  59. USE_L10N = True
  60. USE_TZ = True
  61.  
  62. ## django-compressor settings, for speeding up page load times by minifying CSS and JavaScript files.
  63. # Documentation: https://django-compressor.readthedocs.io/en/latest/
  64. COMPRESS_OUTPUT_DIR = 'cache'
  65. COMPRESS_CSS_FILTERS = [
  66.     'compressor.filters.css_default.CssAbsoluteFilter',
  67.     'compressor.filters.cssmin.CSSMinFilter',
  68. ]
  69. COMPRESS_JS_FILTERS = ['compressor.filters.jsmin.JSMinFilter']
  70. COMPRESS_STORAGE = 'compressor.storage.GzipCompressorFileStorage'
  71. STATICFILES_FINDERS += ('compressor.finders.CompressorFinder',)
  72.  
  73.  
  74. #########################################
  75. ########## Email configuration ##########
  76. #########################################
  77. # See <https://docs.djangoproject.com/en/1.11/topics/email/#email-backends>
  78. # for more documentation. You should follow the information there to define
  79. # your email settings.
  80.  
  81. # Use this if you are just testing.
  82. #EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
  83.  
  84. # The following block is included for your convenience, if you want
  85. # to use Gmail.
  86. #EMAIL_USE_TLS = True
  87. #EMAIL_HOST = 'smtp.gmail.com'
  88. #EMAIL_HOST_USER = '<your account>@gmail.com'
  89. #EMAIL_HOST_PASSWORD = '<your password>'
  90. #EMAIL_PORT = 587
  91.  
  92. # To use Mailgun, uncomment this block.
  93. # You will need to run `pip install django-mailgun` for to get `MailgunBackend`.
  94. #EMAIL_BACKEND = 'django_mailgun.MailgunBackend'
  95. #MAILGUN_ACCESS_KEY = '<your Mailgun access key>'
  96. #MAILGUN_SERVER_NAME = '<your Mailgun domain>'
  97.  
  98. # You can also use Sendgrid, with `pip install sendgrid-django`.
  99. #EMAIL_BACKEND = 'sgbackend.SendGridBackend'
  100. #SENDGRID_API_KEY = '<Your SendGrid API Key>'
  101.  
  102. # The DMOJ site is able to notify administrators of errors via email,
  103. # if configured as shown below.
  104.  
  105. # A tuple of (name, email) pairs that specifies those who will be mailed
  106. # when the server experiences an error when DEBUG = False.
  107. ADMINS = (
  108.     ('Yesterday17', 't@yesterday17.cn'),
  109. )
  110.  
  111. # The sender for the aforementioned emails.
  112. SERVER_EMAIL = 'Hatsune <bot@yesterday17.cn>'
  113.  
  114.  
  115. ##################################################
  116. ########### Static files configuration. ##########
  117. ##################################################
  118. # See <https://docs.djangoproject.com/en/1.11/howto/static-files/>.
  119.  
  120. # Change this to somewhere more permanent., especially if you are using a
  121. # webserver to serve the static files. This is the directory where all the
  122. # static files DMOJ uses will be collected to.
  123. # You must configure your webserver to serve this directory as /static/ in production.
  124. STATIC_ROOT = '/tmp/static'
  125.  
  126. # URL to access static files.
  127. #STATIC_URL = '/static/'
  128.  
  129. # Uncomment to use hashed filenames with the cache framework.
  130. #STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.CachedStaticFilesStorage'
  131.  
  132. ############################################
  133. ########## DMOJ-specific settings ##########
  134. ############################################
  135.  
  136. ## DMOJ site display settings.
  137. SITE_NAME = 'YOJ'
  138. SITE_LONG_NAME = 'Yesterday17\'s Online Judge'
  139. SITE_ADMIN_EMAIL = 't@yesterday17.cn'
  140. TERMS_OF_SERVICE_URL = '//oj.yesterday17.cn/tos' # Use a flatpage.
  141.  
  142. ## Bridge controls.
  143. # The judge connection address and port; where the judges will connect to the site.
  144. # You should change this to something your judges can actually connect to
  145. # (e.g., a port that is unused and unblocked by a firewall).
  146. BRIDGED_JUDGE_ADDRESS = [('localhost', 9999)]
  147.  
  148. # The bridged daemon bind address and port to communicate with the site.
  149. #BRIDGED_DJANGO_ADDRESS = [('localhost', 9998)]
  150.  
  151. ## DMOJ features.
  152. # Set to True to enable full-text searching for problems.
  153. ENABLE_FTS = True
  154.  
  155. # Set of email providers to ban when a user registers, e.g., {'throwawaymail.com'}.
  156. BAD_MAIL_PROVIDERS = set()
  157.  
  158. ## Event server.
  159. # Uncomment to enable live updating.
  160. #EVENT_DAEMON_USE = True
  161.  
  162. # Uncomment this section to use websocket/daemon.js included in the site.
  163. #EVENT_DAEMON_POST = '<ws:// URL to post to>'
  164.  
  165. # If you are using the defaults from the guide, it is this:
  166. #EVENT_DAEMON_POST = 'ws://127.0.0.1:15101/'
  167.  
  168. # These are the publicly accessed interface configurations.
  169. # They should match those used by the script.
  170. #EVENT_DAEMON_GET = '<public ws:// URL for clients>'
  171. #EVENT_DAEMON_GET_SSL = '<public wss:// URL for clients>'
  172. #EVENT_DAEMON_POLL = '<public URL to access the HTTP long polling of event server>'
  173. # i.e. the path to /channels/ exposed by the daemon, through whatever proxy setup you have.
  174.  
  175. # Using our standard nginx configuration, these should be.
  176. #EVENT_DAEMON_GET = 'ws://<your domain>/event/'
  177. #EVENT_DAEMON_GET_SSL = 'wss://<your domain>/event/' # Optional
  178. #EVENT_DAEMON_POLL = '/channels/'
  179.  
  180. # If you would like to use the AMQP-based event server from <https://github.com/DMOJ/event-server>,
  181. # uncomment this section instead. This is more involved, and recommended to be done
  182. # only after you have a working event server.
  183. #EVENT_DAEMON_AMQP = '<amqp:// URL to connect to, including username and password>'
  184. #EVENT_DAEMON_AMQP_EXCHANGE = '<AMQP exchange to use>'
  185.  
  186. ## CDN control.
  187. # Base URL for a copy of ace editor.
  188. # Should contain ace.js, along with mode-*.js.
  189. ACE_URL = '//cdnjs.cloudflare.com/ajax/libs/ace/1.2.3/'
  190. JQUERY_JS = '//cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js'
  191. SELECT2_JS_URL = '//cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/js/select2.min.js'
  192. SELECT2_CSS_URL = '//cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/css/select2.min.css'
  193.  
  194. # A map of Earth in Equirectangular projection, for timezone selection.
  195. # Please try not to hotlink this poor site.
  196. TIMEZONE_MAP = 'http://naturalearth.springercarto.com/ne3_data/8192/textures/3_no_ice_clouds_8k.jpg'
  197.  
  198. ## Camo (https://github.com/atmos/camo) usage.
  199. #CAMO_URL = "<URL to your camo install>"
  200. #CAMO_KEY = "<The CAMO_KEY environmental variable you used>"
  201.  
  202. # Domains to exclude from being camo'd.
  203. #CAMO_EXCLUDE = ("https://dmoj.ml", "https://dmoj.ca")
  204.  
  205. # Set to True to use https when dealing with protocol-relative URLs.
  206. # See <http://www.paulirish.com/2010/the-protocol-relative-url/> for what they are.
  207. #CAMO_HTTPS = False
  208.  
  209. # HTTPS level. Affects <link rel='canonical'> elements generated.
  210. # Set to 0 to make http URLs canonical.
  211. # Set to 1 to make the currently used protocol canonical.
  212. # Set to 2 to make https URLs canonical.
  213. #DMOJ_HTTPS = 0
  214.  
  215. ## PDF rendering settings.
  216. # Directory to cache the PDF.
  217. #PROBLEM_PDF_CACHE = '/home/dmoj-uwsgi/pdfcache'
  218.  
  219. # Path to use for nginx's X-Accel-Redirect feature.
  220. # Should be an internal location mapped to the above directory.
  221. #PROBLEM_PDF_INTERNAL = '/pdfcache'
  222.  
  223. # Path to a PhantomJS executable.
  224. #PHANTOMJS = '/usr/local/bin/phantomjs'
  225.  
  226. # If you can't use PhantomJS or prefer wkhtmltopdf, set the path to wkhtmltopdf executable instead.
  227. #WKHTMLTOPDF = '/usr/local/bin/wkhtmltopdf'
  228.  
  229. # Note that PhantomJS is preferred over wkhtmltopdf and would be used when both are defined.
  230.  
  231. ## ======== Logging Settings ========
  232. # Documentation: https://docs.djangoproject.com/en/1.9/ref/settings/#logging
  233. #                https://docs.python.org/2/library/logging.config.html#logging-config-dictschema
  234. LOGGING = {
  235.     'version': 1,
  236.     'disable_existing_loggers': False,
  237.     'formatters': {
  238.         'file': {
  239.             'format': '%(levelname)s %(asctime)s %(module)s %(message)s',
  240.         },
  241.         'simple': {
  242.             'format': '%(levelname)s %(message)s',
  243.         },
  244.     },
  245.     'handlers': {
  246.         # You may use this handler as example for logging to other files..
  247.         'bridge': {
  248.             'level': 'INFO',
  249.             'class': 'logging.handlers.RotatingFileHandler',
  250.             'filename': '<desired bridge log path>',
  251.             'maxBytes': 10 * 1024 * 1024,
  252.             'backupCount': 10,
  253.             'formatter': 'file',
  254.         },
  255.         'mail_admins': {
  256.             'level': 'ERROR',
  257.             'class': 'dmoj.throttle_mail.ThrottledEmailHandler',
  258.         },
  259.         'console': {
  260.             'level': 'DEBUG',
  261.             'class': 'logging.StreamHandler',
  262.             'formatter': 'file',
  263.         },
  264.     },
  265.     'loggers': {
  266.         # Site 500 error mails.
  267.         'django.request': {
  268.             'handlers': ['mail_admins'],
  269.             'level': 'ERROR',
  270.             'propagate': False,
  271.         },
  272.         # Judging logs as received by bridged.
  273.         'judge.bridge': {
  274.             'handlers': ['bridge', 'mail_admins'],
  275.             'level': 'INFO',
  276.             'propagate': True,
  277.         },
  278.         # Catch all log to stderr.
  279.         '': {
  280.             'handlers': ['console'],
  281.         },
  282.         # Other loggers of interest. Configure at will.
  283.         #  - judge.user: logs naughty user behaviours.
  284.         #  - judge.problem.pdf: PDF generation log.
  285.         #  - judge.html: HTML parsing errors when processing problem statements etc.
  286.         #  - judge.mail.activate: logs for the reply to activate feature.
  287.         #  - event_socket_server
  288.     },
  289. }
  290.  
  291. ## ======== Integration Settings ========
  292. ## Python Social Auth
  293. # Documentation: https://python-social-auth.readthedocs.io/en/latest/
  294. # You can define these to enable authentication through the following services.
  295. #SOCIAL_AUTH_GOOGLE_OAUTH2_KEY = ''
  296. #SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET = ''
  297. #SOCIAL_AUTH_FACEBOOK_KEY = ''
  298. #SOCIAL_AUTH_FACEBOOK_SECRET = ''
  299. #SOCIAL_AUTH_GITHUB_SECURE_KEY = ''
  300. #SOCIAL_AUTH_GITHUB_SECURE_SECRET = ''
  301. #SOCIAL_AUTH_DROPBOX_OAUTH2_KEY = ''
  302. #SOCIAL_AUTH_DROPBOX_OAUTH2_SECRET = ''
  303.  
  304. ## ======== Custom Configuration ========
  305. # You may add whatever django configuration you would like here.
  306. # Do try to keep it separate so you can quickly patch in new settings.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement