Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Mattia Rizzolo
nm.debian.org
Commits
c8bdab24
Commit
c8bdab24
authored
Sep 16, 2013
by
Enrico Zini
Browse files
Cleanup settings
parent
c5eb3a49
Changes
4
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
c8bdab24
...
...
@@ -10,8 +10,8 @@ Debian NM Front Desk web application
### Configuration
mkdir data # required by default settings
ln -s settings.py.devel settings.py
edit settings.py as needed
ln -s
local_
settings.py.devel
local_
settings.py
edit
local_
settings.py as needed
### First setup
...
...
backend/email.py
View file @
c8bdab24
...
...
@@ -9,9 +9,7 @@ from . import const
log
=
getLogger
(
__name__
)
EMAIL_PUBLIC_ANNOUNCES
=
getattr
(
settings
,
"EMAIL_PUBLIC_ANNOUNCES"
,
"debian-newmaint@lists.debian.org"
)
EMAIL_PRIVATE_ANNOUNCES
=
getattr
(
settings
,
"EMAIL_PRIVATE_ANNOUNCES"
,
"nm@debian.org"
)
EMAIL_PERSONAL_DIVERT
=
getattr
(
settings
,
"EMAIL_PERSONAL_DIVERT"
,
None
)
def
get_email_address
(
request
):
"""
...
...
@@ -26,24 +24,11 @@ def get_email_address(request):
email_address
=
request
.
person
.
email
return
email_address
def
announce_public
(
request
,
subject
,
text
):
sender_addr
=
get_email_address
(
request
)
fromaddr
=
email
.
utils
.
formataddr
((
request
.
person
.
fullname
+
" via nm"
,
sender_addr
))
send_mail
(
subject
,
text
,
fromaddr
,
[
EMAIL_PUBLIC_ANNOUNCES
])
def
announce_private
(
request
,
subject
,
text
):
sender_addr
=
get_email_address
(
request
)
fromaddr
=
email
.
utils
.
formataddr
((
request
.
person
.
fullname
+
" via nm"
,
sender_addr
))
send_mail
(
subject
,
text
,
fromaddr
,
[
EMAIL_PRIVATE_ANNOUNCES
])
def
personal_email
(
request
,
recipients
,
subject
,
text
):
# TODO: Cc EMAIL_PRIVATE_ANNOUNCES?
# Details in https://docs.djangoproject.com/en/dev/topics/email/ but needs
# 1.3 for the cc parameter
fromaddr
=
email
.
utils
.
formataddr
((
request
.
person
.
fullname
+
" via nm"
,
"nm@debian.org"
))
# Divert to other recipients when testing, to avoid spamming people with
# test messages
if
EMAIL_PERSONAL_DIVERT
:
recipients
=
EMAIL_PERSONAL_DIVERT
send_mail
(
subject
,
text
,
fromaddr
,
recipients
)
def
parse_recipient_list
(
s
):
...
...
local_settings.py.devel
0 → 100644
View file @
c8bdab24
import os.path
PROJECT_DIR = os.path.abspath(os.path.dirname(__file__))
DATA_DIR = os.path.join(PROJECT_DIR, 'data')
DEBUG = True
TEMPLATE_DEBUG = True
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
'NAME': '%s/db-used-for-development.sqlite' % DATA_DIR, # Or path to database file if using sqlite3.
'USER': '', # Not used with sqlite3.
'PASSWORD': '', # Not used with sqlite3.
'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
'PORT': '', # Set to empty string for default. Not used with sqlite3.
},
'projectb': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'projectb',
'USER': 'guest',
'HOST': 'localhost',
# ssh ries.debian.org -L15433:127.0.0.1:5433
'PORT': '15433', # Port forwarded
#'PORT': '5433', # Local
'TEST_MIRROR': 'default',
},
}
# Make this unique, and don't share it with anybody.
SECRET_KEY = 'thisisnotreallysecretweonlyuseitfortestingharrharr'
# FIXME What is correct format for TEST_USERNAME? Current format ("username")
# causes IndexError at backend/auth.py NMUserBackend:clean_username
# (expects TEST_USERNAME to be in format
# "something:something:something:username"
DACS_TEST_USERNAME = "enrico:enrico:enrico:enrico"
# Avoid sending emails
EMAIL_BACKEND = 'django.core.mail.backends.filebased.EmailBackend'
EMAIL_FILE_PATH = '/tmp/nm_notification_mails'
settings.py
View file @
c8bdab24
...
...
@@ -169,22 +169,24 @@ LOGGING = {
}
}
# BACKUP_DIR = "/srv/nm.debian.org/backup"
BACKUP_DIR
=
"."
#KEYRINGS = "/home/enrico/dev/deb/keyring.debian.org/keyrings"
KEYRINGS
=
os
.
path
.
join
(
DATA_DIR
,
"keyrings"
)
# LDAP server to use to access Debian's official LDAP information
LDAP_SERVER
=
"ldap://db.debian.org"
# Location of a keyring-maint mirror
KEYRINGS
=
os
.
path
.
join
(
DATA_DIR
,
"keyrings"
)
# Work paths used by minechangelogs (indexing cache and the index itself)
MINECHANGELOGS_CACHEDIR
=
os
.
path
.
join
(
DATA_DIR
,
"mc_cache"
)
MINECHANGELOGS_INDEXDIR
=
os
.
path
.
join
(
DATA_DIR
,
"mc_index"
)
EMAIL_PUBLIC_ANNOUNCES
=
"enrico@enricozini.org"
EMAIL_PRIVATE_ANNOUNCES
=
"enrico@enricozini.org"
EMAIL_PERSONAL_DIVERT
=
[
"enrico@enricozini.org"
]
EMAIL_BACKEND
=
'django.core.mail.backends.filebased.EmailBackend'
EMAIL_FILE_PATH
=
'/tmp/nm_notification_mails'
# Directory where site backups are stored
BACKUP_DIR
=
os
.
path
.
join
(
DATA_DIR
,
"backups"
)
PROCESS_MAILBOX_DIR
=
os
.
path
.
abspath
(
"./test-mboxes"
)
# Directory where applicant mailboxes are stored
PROCESS_MAILBOX_DIR
=
os
.
path
.
join
(
DATA_DIR
,
"applicant-mailboxes"
)
# Date where we imported DM information that had no timestamp.
# DMs created on this date are infact DMs created on an unknown date
DM_IMPORT_DATE
=
datetime
.
datetime
(
2012
,
3
,
14
)
# The password for this account is available from: master.debian.org:/home/debian/misc/rt-password
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment