Пример #1
0
def _send_user_registration_email(recipient, domain_name, username, password):
        
    DNS_name = Site.objects.get(id = settings.SITE_ID).domain
    link = 'http://' + DNS_name + reverse('homepage')
    
    text_content = """
An administrator of CommCareHQ domain "{0}" has set up an account for you.
Your username is "{1}", and your password is "{2}".
To login, navigate to the following link:
{3}
"""
    text_content = text_content.format(domain_name, username, password, link)
    cm(text_content)
    html_content = ''.join(['<p>' + x + '</p>' for x in text_content.strip().split('\n')])
    cm(html_content)

    subject = 'New CommCareHQ account'
    
    send_HTML_email(subject, recipient, text_content, html_content)
Пример #2
0
#
import django_path_setup
django_path_setup.set_path()

import os
from common_code.debug_client import console_msg as cm
site_path = os.path.dirname(__file__)
site_template_path = os.path.join(site_path, 'site_templates')

# Apache and Django's runserver mount at different points; check for that here and set
# _PROJECT_MOUNT_POINT accordingly.
#
# DEPENDING ON YOUR WEB SERVER AND OS, YOU WILL HAVE TO CHANGE THIS LOGIC
cwd = os.getcwd()
if 'HQTest' in cwd:
    cm("Running Django's development server")
    _PROJECT_MOUNT_POINT = '/'                    # Local variable name - not known to Django
else:
    cm("Running production web server")
    _PROJECT_MOUNT_POINT = '/HQTest/'             # Local variable name - not known to Django


# Multiple instances of Django running on this one virtual server;
# cookie have to be different on each mount point
SESSION_COOKIE_PATH = _PROJECT_MOUNT_POINT

# This is filled out by calling reverse('login') once the app is up and running.
# Done after all URLConfs are parsed - see HQTest.urls.py
LOGIN_URL = None
# Ditto - set after URLConfs are parsed
LOGIN_REDIRECT_URL = None