0001-simplify-manage.py-and-quick-start-mode-5752.patch
| README | ||
|---|---|---|
| 1 |
Initializing the database |
|
| 1 |
Passerelle provides an uniform access to multiple data sources and services. |
|
| 2 | ||
| 3 |
Quick-start |
|
| 4 |
=========== |
|
| 5 | ||
| 6 |
Setting up an Environment |
|
| 2 | 7 |
------------------------- |
| 3 | 8 | |
| 9 |
The first thing you’ll need is the Python virtualenv package. You probably |
|
| 10 |
already have this, but if not, you can install it with: |
|
| 11 | ||
| 12 |
$ easy_install -UZ virtualenv |
|
| 13 | ||
| 14 |
Once that’s done, choose a location for the environment, and create it with the |
|
| 15 |
virtualenv command. For our guide, we’re going to choose "venv" in the current |
|
| 16 |
directory : |
|
| 17 | ||
| 18 |
$ virtualenv venv |
|
| 19 |
$ source venv/bin/activate |
|
| 20 | ||
| 21 |
Install required Python packages : |
|
| 22 | ||
| 23 |
$ pip install -r requirements.txt |
|
| 24 | ||
| 25 |
Initializing the database (quick-start: sqlite3) |
|
| 26 |
------------------------------------------------ |
|
| 27 | ||
| 4 | 28 |
To create the database, execute the following line: |
| 5 | 29 | |
| 6 |
manage.py --config=config_example.py syncdb --migrate
|
|
| 30 |
$ python manage.py syncdb --migrate
|
|
| 7 | 31 | |
| 8 |
The new database is created inside `passerelle.sqlite3` in the |
|
| 9 |
current directory.
|
|
| 32 |
The new database is created inside `passerelle.sqlite3` in the current
|
|
| 33 |
directory. |
|
| 10 | 34 | |
| 11 | 35 |
Running |
| 12 | 36 |
------- |
| 13 | 37 | |
| 14 | 38 |
The command line for starting is: |
| 15 | 39 | |
| 16 |
manage.py --config=config_example.py runserver
|
|
| 40 |
$ python manage.py runserver
|
|
| 17 | 41 | |
| 18 | 42 |
Passerelle is available on http://127.0.0.1:8000 |
| 19 | 43 | |
| 20 |
Options
|
|
| 21 |
------- |
|
| 44 |
manage.py options
|
|
| 45 |
-----------------
|
|
| 22 | 46 | |
| 23 | 47 |
--config=/path/to/config.py |
| 48 |
Configuration file. See config_example.py for example. |
|
| 24 | 49 | |
| 25 |
Configuration file. MANDATORY. |
|
| 26 | ||
| 27 |
--multitenant |
|
| 28 | ||
| 50 |
--multitenant |
|
| 29 | 51 |
Activate multi-tenant mode. The python-entrouvert package |
| 30 | 52 |
must be installed. |
| 31 | 53 | |
| jenkins.sh | ||
|---|---|---|
| 3 | 3 |
pip install --upgrade pip |
| 4 | 4 |
pip install --upgrade pylint |
| 5 | 5 |
pip install --upgrade -r requirements.txt |
| 6 |
./manage.py --config=config_example.py syncdb --noinput --all
|
|
| 7 |
./manage.py --config=config_example.py migrate --fake
|
|
| 8 |
./manage.py --config=config_example.py validate
|
|
| 6 |
./manage.py syncdb --noinput --all |
|
| 7 |
./manage.py migrate --fake |
|
| 8 |
./manage.py validate |
|
| 9 | 9 |
(pylint -f parseable --rcfile /var/lib/jenkins/pylint.django.rc passerelle/ | tee pylint.out) || /bin/true |
| 10 | 10 | |
| manage.py | ||
|---|---|---|
| 6 | 6 |
multitenant = False |
| 7 | 7 |
config_file = False |
| 8 | 8 | |
| 9 |
for i, arg in enumerate(sys.argv[1:]): |
|
| 10 |
if arg.startswith('-'):
|
|
| 9 |
argv = sys.argv[1:] |
|
| 10 |
for arg in list(argv): |
|
| 11 |
if arg.startswith('--'):
|
|
| 11 | 12 |
if arg.startswith('--config='):
|
| 12 | 13 |
config_file = arg.split('=')[1]
|
| 14 |
argv.pop(0) |
|
| 13 | 15 |
elif arg == '--multitenant': |
| 14 | 16 |
multitenant = True |
| 17 |
argv.pop(0) |
|
| 15 | 18 |
else: |
| 16 | 19 |
print >>sys.stderr, 'ERR: Unsupported flag', arg |
| 17 | 20 |
sys.exit(1) |
| 18 | 21 |
else: |
| 19 | 22 |
break |
| 20 |
if not config_file: |
|
| 21 |
print >>sys.stderr, 'ERR: No configuration file specified, use --config=/path/to/config.py' |
|
| 22 |
sys.exit(1) |
|
| 23 | 23 | |
| 24 |
os.environ['DJANGO_CONFIG_FILE'] = config_file |
|
| 24 |
if config_file: |
|
| 25 |
os.environ['DJANGO_CONFIG_FILE'] = config_file |
|
| 26 | ||
| 25 | 27 |
if multitenant: |
| 26 | 28 |
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "passerelle.tenant_settings")
|
| 27 | 29 |
else: |
| ... | ... | |
| 29 | 31 | |
| 30 | 32 |
from django.core.management import execute_from_command_line |
| 31 | 33 | |
| 32 |
execute_from_command_line(sys.argv[:1] + sys.argv[i+1:]) |
|
| 34 |
execute_from_command_line(sys.argv[:1] + argv) |
|
| passerelle/default_settings.py | ||
|---|---|---|
| 15 | 15 | |
| 16 | 16 |
PACKAGE_PATH = os.path.dirname(__file__) |
| 17 | 17 | |
| 18 |
LANGUAGE_CODE = 'fr-fr' |
|
| 18 |
### Quick-start development settings - unsuitable for production |
|
| 19 |
# See https://docs.djangoproject.com/en/dev/howto/deployment/checklist/ |
|
| 20 | ||
| 21 |
# SECURITY WARNING: keep the secret key used in production secret! |
|
| 22 |
SECRET_KEY = 'please-change-me-with-a-very-long-random-string' |
|
| 23 | ||
| 24 |
# SECURITY WARNING: don't run with debug turned on in production! |
|
| 25 |
DEBUG = True |
|
| 26 |
TEMPLATE_DEBUG = True |
|
| 27 | ||
| 28 |
# See https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts |
|
| 29 |
ALLOWED_HOSTS = [] |
|
| 30 | ||
| 31 |
DATABASES = {
|
|
| 32 |
'default': {
|
|
| 33 |
'ENGINE': 'django.db.backends.sqlite3', |
|
| 34 |
'NAME': 'passerelle.sqlite3', |
|
| 35 |
} |
|
| 36 |
} |
|
| 37 | ||
| 38 |
### End of "Quick-start development settings" |
|
| 39 | ||
| 19 | 40 | |
| 20 | 41 |
# If you set this to False, Django will not format dates, numbers and |
| 21 | 42 |
# calendars according to the current locale. |
| ... | ... | |
| 54 | 75 |
WSGI_APPLICATION = 'passerelle.wsgi.application' |
| 55 | 76 | |
| 56 | 77 |
LOCALE_PATHS = (os.path.join(PACKAGE_PATH, 'locale'),) |
| 78 |
LANGUAGE_CODE = 'fr-fr' |
|
| 57 | 79 | |
| 58 | 80 |
TEMPLATE_DIRS = (os.path.join(PACKAGE_PATH, 'templates'),) |
| 59 | 81 | |
| ... | ... | |
| 63 | 85 |
) |
| 64 | 86 | |
| 65 | 87 |
INSTALLED_APPS = ( |
| 88 |
# system apps |
|
| 66 | 89 |
'django.contrib.auth', |
| 67 | 90 |
'django.contrib.contenttypes', |
| 68 | 91 |
'django.contrib.sessions', |
| 69 | 92 |
'django.contrib.messages', |
| 70 | 93 |
'django.contrib.staticfiles', |
| 71 |
# Uncomment the next line to enable the admin: |
|
| 72 | 94 |
'django.contrib.admin', |
| 73 |
# Uncomment the next line to enable admin documentation: |
|
| 74 |
# 'django.contrib.admindocs', |
|
| 75 | 95 |
'south', |
| 96 |
# base apps |
|
| 76 | 97 |
'passerelle.base', |
| 77 | 98 |
'passerelle.datasources', |
| 78 | 99 |
'passerelle.repost', |
| 79 | 100 |
'passerelle.messages', |
| 80 | 101 |
'passerelle.register', |
| 81 |
#'passerelle.queue',
|
|
| 102 |
# connectors
|
|
| 82 | 103 |
'clicrdv', |
| 83 | 104 |
'gdc', |
| 84 |
#'solis', |
|
| 85 |
#'makorepost', |
|
| 86 | 105 |
'choosit', |
| 87 | 106 |
'oxyd', |
| 88 | 107 |
'ovh', |
| 89 | 108 |
'mobyt', |
| 90 | 109 |
'pastell', |
| 91 | 110 |
'concerto', |
| 111 |
# backoffice templates and static |
|
| 92 | 112 |
'gadjo', |
| 93 | 113 |
) |
| 94 | 114 | |
| 95 |
- |
|