settings.py 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451
  1. """
  2. Django settings for MAB18_site project.
  3. Generated by 'django-admin startproject' using Django 2.0.7.
  4. For more information on this file, see
  5. https://docs.djangoproject.com/en/2.0/topics/settings/
  6. For the full list of settings and their values, see
  7. https://docs.djangoproject.com/en/2.0/ref/settings/
  8. """
  9. import os
  10. from django.utils.translation import ugettext_lazy as _
  11. try:
  12. from .settings_local import *
  13. except:
  14. pass
  15. # SECURITY WARNING: don't run with debug turned on in production!
  16. try:
  17. os.environ['django_DEBUG']
  18. if os.environ['django_DEBUG'] == 'True':
  19. DEBUG = True
  20. else:
  21. DEBUG = False
  22. except KeyError:
  23. DEBUG = True
  24. # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
  25. PROJECT_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir))
  26. PACKAGE_ROOT = os.path.abspath(os.path.dirname(__file__))
  27. BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
  28. # Static files (CSS, JavaScript, Images)
  29. # https://docs.djangoproject.com/en/2.0/howto/static-files/
  30. #STATIC_URL = "https://cdn.awards.mediaarchitecture.org/site_media/static/"
  31. #MEDIA_URL = "https://cdn.awards.mediaarchitecture.org/site_media/media/"
  32. STATIC_ROOT = os.path.join(PROJECT_ROOT, "site_media", "static")
  33. MEDIA_ROOT = os.path.join(PROJECT_ROOT, "site_media", "media")
  34. try:
  35. os.environ['django_MEDIA_URL']
  36. MEDIA_URL = os.environ['django_MEDIA_URL']
  37. except:
  38. MEDIA_URL = '/site_media/media/'
  39. try:
  40. os.environ['django_STATIC_URL']
  41. STATIC_URL = os.environ['django_STATIC_URL']
  42. except:
  43. STATIC_URL = '/site_media/static/'
  44. try:
  45. os.environ['django_IMPORT_PATH']
  46. IMPORT_PATH = os.environ['django_IMPORT_PATH']
  47. except KeyError:
  48. IMPORT_PATH = '/'
  49. try:
  50. os.environ['django_OLD_IMPORT_PATH']
  51. OLD_IMPORT_PATH = os.environ['django_OLD_IMPORT_PATH']
  52. except KeyError:
  53. OLD_IMPORT_PATH = '/'
  54. try:
  55. os.environ['django_TEMP_PATH']
  56. TEMP_PATH = os.environ['django_TEMP_PATH']
  57. except KeyError:
  58. TEMP_PATH = '/'
  59. # Quick-start development settings - unsuitable for production
  60. # See https://docs.djangoproject.com/en/2.0/howto/deployment/checklist/
  61. # SECURITY WARNING: keep the secret key used in production secret!
  62. try:
  63. os.environ['django_SECRET_KEY']
  64. SECRET_KEY = os.environ['django_SECRET_KEY']
  65. except KeyError:
  66. SECRET_KEY = 'KsN_QZ_fWqs18Z-3o}2~z0-@NA+/lP{YwVosC>6:Gxbu>ePUw=+Gv6lIZWR'
  67. try:
  68. os.environ['django_ALLOWED_HOSTS']
  69. ENV_ALLOWED_HOSTS = os.environ['django_ALLOWED_HOSTS']
  70. ALLOWED_HOSTS = []
  71. ALLOWED_HOSTS.extend( ENV_ALLOWED_HOSTS.split() )
  72. except KeyError:
  73. ALLOWED_HOSTS = ['*']
  74. #if DEBUG == True:
  75. # ALLOWED_HOSTS = ['*']
  76. #else:
  77. # ALLOWED_HOSTS = ['awards.mediaarchitecture.org', 'devawards.mediaarchitecture.org', 'devcatalog.mediaarchitecture.org' 'catalog.mediaarchitecture.org', 'localhost']
  78. # Constance settings
  79. SPONSOR_CARDS = """
  80. {% load static %}
  81. <div class="mab-card card border-thin border-0 rounded-0" style="">
  82. <a href="https://www.mediaarchitecture.org">
  83. <div style="position: relative;text-align: center;">
  84. <img class="card-img-top rounded-0" src="{% static 'logo_MAI.jpg' %}" style=" " alt="image">
  85. </div>
  86. </a>
  87. <div class="card-body" style="padding: 5px">
  88. <div class="border-0 d-flex justify-content">
  89. <p class="card-title"><a href="{% static 'MAB2018logo.png' %}">MAI<br>MAI Sponsor - YEAR, CITY, COUNTRY<br></a></p>
  90. </div>
  91. <p class="card-text" style="color: black; margin-top:0px">
  92. <a href="https://www.mediaarchitecture.org">
  93. <nobr>
  94. <button class="border-thin mybtn" style="margin-right: 2px;margin-bottom: 2px">#MAB</button>
  95. </nobr>
  96. </a>
  97. <a href="">
  98. <nobr>
  99. <button class="border-thin mybtn" style="margin-right: 2px;margin-bottom: 2px">#Sponsor</button>
  100. </nobr>
  101. </a>
  102. <a href="https://www.mediaarchitecture.org">
  103. <nobr>
  104. <button class="border-thin mybtn" style="margin-right: 2px;margin-bottom: 2px">#NAME</button>
  105. </nobr>
  106. </a>
  107. </p>
  108. </div>
  109. </div>
  110. """
  111. ABOUT_TEXT = """
  112. {% load static %}
  113. <div class="container" style="margin-top: 20px;">
  114. <h3>MAB Catalogue</h3>
  115. <br />
  116. <p>&nbsp;</p>
  117. <p><small> <strong>Our Sponsors:</strong><br /> -<br /> </small></p>
  118. <p><small> <strong>Exhibition curators</strong><br />-<br /> </small></p>
  119. <p><small> <strong>System developer</strong><br /> -<br /> </small></p>
  120. <p><small> <strong>This is a website by </strong><br /> <img src="{% static 'logo_MAI.jpg' %}" width="auto" height="50px" /><br /> Gisela Legath-Gasse 5 / 1<br /> 1220 Vienna &ndash; Austria<br /> <a href="www.mediaarchitecture.org">www.mediaarchitecture.org</a><br /> awards@mediaarchitecture.org<br /> ZVR-Zahl: 501926485<br /> ATU69058814<br /><br /> Please have a look at our privacy policy: <br /> <a href="https://www.mediaarchitecture.org/privacy-policy/">https://www.mediaarchitecture.org/privacy-policy/</a><br /> </small></p>
  121. </div>
  122. """
  123. MAIN_CARD = """
  124. {% load static %}
  125. <div class="card rounded-0 border-0" style="width: 97%; height: 95%; display:inline-block; margin-top:4px; max-width: 100%">
  126. <a href="">
  127. <div style="position: relative;text-align: center;">
  128. <img class="card-img-top rounded-0" src="{% static 'MAB_logo.png' %}" alt="image">
  129. <div style="position: absolute;bottom: 8px;left: 16px;color: white; font-size: medium; font-weight: bold; text-align: left;background-color: rgba(0,0,0,0.21)">Title</div>
  130. </div>
  131. </a>
  132. <div class="card-body" style="padding: 5px">
  133. <div class="border-0 d-flex justify-content">
  134. <p class="card-title" style="margin-bottom: 3px"><a href=""> Header </a></p>
  135. </div>
  136. <p class="card-text" style="color: black;margin-top: 0px">
  137. <button id='' class="border-thin mybtn" style="">Tag A</button>
  138. <button id='' class="border-thin mybtn" style="">Tag B</button>
  139. <button id='' class="border-thin mybtn" style="">Tag C</button>
  140. </p>
  141. </div>
  142. </div>
  143. """
  144. INFO_TXT = """
  145. <div><span style="font-weight: bold;">Please note:</span></div>
  146. <ul><li><div>Fill in as <span style="font-weight: bold;">many fields</span> as possible.</div></li>
  147. <li><div><span style="font-weight: bold;">Mandatory fields</span> are marked with an asterisk*.</div></li>
  148. <li><div>Don’t forget to press the <span style="font-weight: bold;">„Save“ button</span> from time to time ;-)</div></li>
  149. <li><div>Feel free to <span style="font-weight: bold;">share this form</span> within your team and partners, so that they can add additional information. (They have to use the same login as you)</div></li>
  150. <li><div><span style="font-weight: bold;">Please note that you can edit all entries until the deadline</span></div></li>
  151. <li><div><span style="font-weight: bold;">The deadline is &nbsp;June 14 2020 at 10:00 pm</span></div></li></ul>
  152. <div><span style="font-weight: bold;">After the deadline we take what is in the form. So make sure that least all required fields are filled in and you have added at least 4 media (Photos or Videos) You can only add media after you have entered all mandatory fields.</span></div>
  153. <div><br></div><div><span style="font-weight: bold;">So, have fun!&nbsp;</span>
  154. <span style="font-weight: bold;">We really look forward to your project!</span></div>
  155. <div><span style="font-weight: bold;">Hopefully see you in Amsterdam,</span></div>
  156. <div><span style="font-weight: bold;">Gernot and the MAB Team!</span></div>
  157. """
  158. SUBMIT_TEXT = """
  159. <div>Yes you got it! On this page you can submit proposals to the MAB20 Awards!</div><div><br></div>
  160. <div>We are pleased to announce that the international Media Architecture Biennale 2020, will take place 23 · 27 November 2020 in Amsterdam / Utrecht in the Netherlands.</div>
  161. <div><br></div><div>In order to submit projects to the MAB Awards pls proceed as follows:</div>
  162. <div><br></div><ol><li><div style="text-align: left;"><span style="font-size: 14px; text-decoration: underline;">download the MAB Awards Call (PDF)</span></div>
  163. </li><li><div style="text-align: left;"><a href="/mab/register/">register</a></div></li>
  164. <li><div style="text-align: left;"><a href="/mab/addProject/?">submit your project&nbsp;</a></div></li></ol>
  165. <div style="margin-top: 1em; margin-bottom: 1em;"></div><div style="margin-top: 1em; margin-bottom: 1em;"></div>
  166. <div>You can invite your team and partners to fill in the project form. (They have to use the same login as you)</div>
  167. <div>It’s work in progress. ;.-) You don’t have to fill in everything at one time and you can edit all entries until the deadline.</div>
  168. <div><span style="font-weight: bold;">The deadline is &nbsp;June 14 2020 at 10:00 pm</span></div><div><br>
  169. </div><div>So, have fun!&nbsp;We really look forward to your project!</div><div>Hopefully see you in Amsterdam,</div>
  170. <div>Gernot and the MAB Team!</div><div><br></div><div style="margin-top: 1em; margin-bottom: 1em;"></div>
  171. <div style="margin-top: 1em; margin-bottom: 1em;"><span data-en-paragraph="true" data-en-has-metadata="true" style="font-weight: bold;">JURY MEMBERS:</span>
  172. </div><div style="margin-top: 1em; margin-bottom: 1em;"><span data-en-paragraph="true" data-en-has-metadata="true" style="font-weight: bold;">Martijn de Waal</span><span data-en-paragraph="true" data-en-has-metadata="true"> – University of Applied Sciences, Amsterdam</span></div>
  173. <div style="margin-top: 1em; margin-bottom: 1em;"><span data-en-paragraph="true" data-en-has-metadata="true">
  174. <span style="font-weight: bold;">Gernot Tscherteu</span> - Media Architecture Institute, Vienna</span></div>
  175. <div style="margin-top: 1em; margin-bottom: 1em;"><span data-en-paragraph="true" data-en-has-metadata="true" style="font-weight: bold;">Juan Carlos Carvajal B.</span><span data-en-paragraph="true" data-en-has-metadata="true"> –&nbsp;</span><span data-en-paragraph="true" data-en-has-metadata="true">Media Architecture Institute, Vienna</span></div><div style="margin-top: 1em; margin-bottom: 1em;">
  176. <span data-en-paragraph="true" data-en-has-metadata="true" style="font-weight: bold;">Susa Pop</span><span data-en-paragraph="true" data-en-has-metadata="true"> – Public Art Lab, Berlin
  177. </span></div><div style="margin-top: 1em; margin-bottom: 1em;"><span data-en-paragraph="true" data-en-has-metadata="true" style="font-weight: bold;">Tanya Toft Ag</span><span data-en-paragraph="true" data-en-has-metadata="true"> – Urban Media Art Academy, Hong Kong
  178. </span></div><div style="margin-top: 1em; margin-bottom: 1em;"><span data-en-paragraph="true" data-en-has-metadata="true" style="font-weight: bold;">Luke Hespanhol</span><span data-en-paragraph="true" data-en-has-metadata="true"> – The University of Sydney, Sydney
  179. </span></div><div style="margin-top: 1em; margin-bottom: 1em;"><span data-en-paragraph="true" data-en-has-metadata="true" style="font-weight: bold;">Ava Fatah gen. Schieck</span><span data-en-paragraph="true" data-en-has-metadata="true"> – The Bartlett, University College London
  180. </span></div><div style="margin-top: 1em; margin-bottom: 1em;"><span data-en-paragraph="true" data-en-has-metadata="true" style="font-weight: bold;">Dave Colangelo</span><span data-en-paragraph="true" data-en-has-metadata="true"> – Portland State University, Portland
  181. </span></div><div style="margin-top: 1em; margin-bottom: 1em;"><span data-en-paragraph="true" data-en-has-metadata="true" style="font-weight: bold;">Martin Tomitsch</span><span data-en-paragraph="true" data-en-has-metadata="true"> – The University of Sydney, Sydney
  182. </span></div><div style="margin-top: 1em; margin-bottom: 1em;"><span data-en-paragraph="true" data-en-has-metadata="true" style="font-weight: bold;">M. Hank Haeusler</span><span data-en-paragraph="true" data-en-has-metadata="true"> – UNSW Sydney
  183. </span></div><div style="margin-top: 1em; margin-bottom: 1em;"><br></div><div style="margin-top: 1em; margin-bottom: 1em;"><span style="font-weight: bold;">We would like to thank our sponsors:</span></div><div style="margin-top: 1em; margin-bottom: 1em;"><br></div><div style="margin-top: 1em; margin-bottom: 1em;"><span style="font-weight: bold;">Sponsors</span></div>
  184. <div style="margin-top: 1em; margin-bottom: 1em;"><br></div>
  185. </div>
  186. """
  187. CONSTANCE_BACKEND = 'constance.backends.database.DatabaseBackend'
  188. CONSTANCE_CONFIG = {
  189. 'ABOUT_CONTENT': (ABOUT_TEXT, 'Text for the about page'),
  190. 'SPONSOR_CARDS': (SPONSOR_CARDS, 'HTML for the sponsor cards'),
  191. 'MAIN_CARD': (MAIN_CARD, 'HTML for the main card'),
  192. 'CURRENT_EVENT': ('MAB20', 'Filter for the projects that should be evaluated'),
  193. 'INFO_TXT': (INFO_TXT, 'Text to help with the fill in the submitform'),
  194. 'SUBMIT_TEXT': (SUBMIT_TEXT, 'Text to welcome to the submitpage'),
  195. 'ADMIN_EMAIL': ('juan@mediaarchitecture.org', 'Admin email'),
  196. }
  197. # Application definition
  198. INSTALLED_APPS = [
  199. 'django.contrib.admin',
  200. 'django.contrib.auth',
  201. 'django.contrib.contenttypes',
  202. 'django.contrib.sessions',
  203. 'django.contrib.messages',
  204. 'django.contrib.staticfiles',
  205. 'marktplatz',
  206. 'constance',
  207. 'constance.backends.database',
  208. 'imagekit',
  209. 'crispy_forms',
  210. 'django_file_form',
  211. 'django_file_form.ajaxuploader',
  212. 'django_countries',
  213. 'captcha',
  214. ]
  215. CRISPY_TEMPLATE_PACK = 'bootstrap4'
  216. CAPTCHA_NOISE_FUNCTIONS=('captcha.helpers.noise_dots',)
  217. CAPTCHA_LETTER_ROTATION=(-15,15)
  218. MIDDLEWARE = [
  219. 'django.middleware.security.SecurityMiddleware',
  220. 'django.contrib.sessions.middleware.SessionMiddleware',
  221. 'django.middleware.common.CommonMiddleware',
  222. 'django.middleware.csrf.CsrfViewMiddleware',
  223. 'django.contrib.auth.middleware.AuthenticationMiddleware',
  224. 'django.contrib.messages.middleware.MessageMiddleware',
  225. 'django.middleware.clickjacking.XFrameOptionsMiddleware',
  226. ]
  227. # 'htmlmin.middleware.HtmlMinifyMiddleware',
  228. # 'htmlmin.middleware.MarkRequestMiddleware',
  229. ROOT_URLCONF = 'MAB18_site.urls'
  230. TEMPLATES = [
  231. {
  232. 'BACKEND': 'django.template.backends.django.DjangoTemplates',
  233. 'DIRS': [os.path.join(PACKAGE_ROOT, "templates"),'./templates','./MAB18_site', ],
  234. 'APP_DIRS': True,
  235. 'OPTIONS': {
  236. 'context_processors': [
  237. 'constance.context_processors.config',
  238. 'django.template.context_processors.debug',
  239. 'django.template.context_processors.request',
  240. 'django.contrib.auth.context_processors.auth',
  241. 'django.contrib.messages.context_processors.messages',
  242. ],
  243. },
  244. },
  245. ]
  246. WSGI_APPLICATION = 'MAB18_site.wsgi.application'
  247. EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
  248. LOGIN_REDIRECT_URL = '/mab/home/'
  249. # Database
  250. # https://docs.djangoproject.com/en/2.0/ref/settings/#databases
  251. try:
  252. os.environ['django_DB_ENGINE']
  253. DB_ENGINE = os.environ['django_DB_ENGINE']
  254. except KeyError:
  255. DB_ENGINE = 'django.db.backends.sqlite3'
  256. try:
  257. os.environ['django_DB_NAME']
  258. DB_NAME = os.environ['django_DB_NAME']
  259. except KeyError:
  260. DB_NAME = os.path.join(BASE_DIR, 'db.sqlite3')
  261. try:
  262. os.environ['django_DB_USER']
  263. DB_USER = os.environ['django_DB_USER']
  264. except KeyError:
  265. DB_USER = ''
  266. try:
  267. os.environ['django_DB_PASSWORD']
  268. DB_PASSWORD = os.environ['django_DB_PASSWORD']
  269. except KeyError:
  270. DB_PASSWORD = ''
  271. try:
  272. os.environ['django_DB_HOST']
  273. DB_HOST = os.environ['django_DB_HOST']
  274. except KeyError:
  275. DB_HOST = ''
  276. try:
  277. os.environ['django_DB_PORT']
  278. DB_PORT = os.environ['django_DB_PORT']
  279. except KeyError:
  280. DB_PORT = ''
  281. if DB_ENGINE == "django.db.backends.mysql" :
  282. DB_OPTIONS = {'init_command': "SET sql_mode='STRICT_TRANS_TABLES'"}
  283. else:
  284. DB_OPTIONS = {}
  285. DATABASES = {
  286. "default": {
  287. "ENGINE": DB_ENGINE,
  288. "NAME": DB_NAME,
  289. "USER": DB_USER,
  290. "PASSWORD": DB_PASSWORD,
  291. "HOST": DB_HOST,
  292. "PORT": DB_PORT,
  293. "OPTIONS" : DB_OPTIONS
  294. }
  295. }
  296. # Password validation
  297. # https://docs.djangoproject.com/en/2.0/ref/settings/#auth-password-validators
  298. AUTH_PASSWORD_VALIDATORS = [
  299. {
  300. 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
  301. },
  302. {
  303. 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
  304. },
  305. {
  306. 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
  307. },
  308. {
  309. 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
  310. },
  311. ]
  312. # Internationalization
  313. # https://docs.djangoproject.com/en/2.0/topics/i18n/
  314. LANGUAGE_CODE = 'en-us'
  315. # Local time zone for this installation. Choices can be found here:
  316. # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
  317. # although not all choices may be available on all operating systems.
  318. # On Unix systems, a value of None will cause Django to use the same
  319. # timezone as the operating system.
  320. # If running in a Windows environment this must be set to the same as your
  321. # system time zone.
  322. TIME_ZONE = "Europe/Vienna"
  323. USE_I18N = True
  324. USE_L10N = True
  325. USE_TZ = True
  326. #MAIL
  327. try:
  328. os.environ['django_DEFAULT_FROM_EMAIL']
  329. DEFAULT_FROM_EMAIL = os.environ['django_DEFAULT_FROM_EMAIL']
  330. except:
  331. DEFAULT_FROM_EMAIL = 'webmaster@localhost'
  332. try:
  333. os.environ['django_EMAIL_BACKEND']
  334. EMAIL_BACKEND = os.environ['django_EMAIL_BACKEND']
  335. except KeyError:
  336. EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"
  337. try:
  338. os.environ['django_EMAIL_HOST']
  339. EMAIL_HOST = os.environ['django_EMAIL_HOST']
  340. except KeyError:
  341. EMAIL_HOST = ''
  342. try:
  343. os.environ['django_EMAIL_HOST_USER']
  344. EMAIL_HOST_USER = os.environ['django_EMAIL_HOST_USER']
  345. except:
  346. EMAIL_HOST_USER = ''
  347. try:
  348. os.environ['django_EMAIL_HOST_PASSWORD']
  349. EMAIL_HOST_PASSWORD = os.environ['django_EMAIL_HOST_PASSWORD']
  350. except KeyError:
  351. EMAIL_HOST_PASSWORD = ''
  352. try:
  353. os.environ['django_EMAIL_PORT']
  354. EMAIL_PORT = os.environ['django_EMAIL_PORT']
  355. except KeyError:
  356. EMAIL_PORT = ''
  357. try:
  358. os.environ['django_EMAIL_USE_SSL']
  359. if os.environ['django_EMAIL_USE_SSL'] == 'True' :
  360. EMAIL_USE_SSL = True
  361. else:
  362. EMAIL_USE_SSL = False
  363. except KeyError:
  364. EMAIL_USE_SSL = False