-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsettings_local_example.py
60 lines (54 loc) · 1.76 KB
/
settings_local_example.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import os
import configparser
from pathlib import Path
from django.utils.translation import gettext_lazy as _
SECRET_KEY = '<YOUR VERY SECRET KEY>'
DEBUG = True #Change to False when in production
ALLOWED_HOSTS = ['<YOUR HOSTS>']
HOME = os.environ.get('HOME') or ""
SOCIAL_AUTH_MEDIAWIKI_KEY = '<YOUR MEDIAWIKI KEY>'
SOCIAL_AUTH_MEDIAWIKI_SECRET = '<YOUR MEDIAWIKI TOKEN'
SOCIAL_AUTH_MEDIAWIKI_URL = 'https://meta.wikimedia.org/w/index.php'
SOCIAL_AUTH_MEDIAWIKI_CALLBACK = '<YOUR HOST>/oauth/complete/mediawiki/'
BASE_DIR = Path(__file__).resolve().parent.parent
replica_path = HOME + '/replica.my.cnf'
if os.path.exists(replica_path):
config = configparser.ConfigParser()
config.read(replica_path)
elasticsearch = configparser.ConfigParser()
elasticsearch.read(HOME + '/.elasticsearch.ini')
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': '<YOUR DATABASE>',
'USER': config['client']['user'],
'PASSWORD': config['client']['password'],
'HOST': 'tools.db.svc.wikimedia.cloud',
'PORT': '',
}
}
ELASTICSEARCH_DSL={
'default': {
'hosts': 'http://elasticsearch.svc.tools.eqiad1.wikimedia.cloud:80',
'http_auth': (elasticsearch['username'] , elasticsearch['password'])
}
}
else:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
}
}
ELASTICSEARCH_DSL={
'default': {
'hosts': 'http://localhost:9200'
}
}
print('replica.my.cnf file not found')
LANGUAGES = (
('en', _('English')),
('pt-br', _('Brazilian Portuguese')),
('pt', _('Portuguese')),
('es', _('Spanish')),
)