simplify manage.py and quick-start mode (#5752)
This commit is contained in:
parent
64ae12112c
commit
1b603959fa
48
README
48
README
|
@ -1,31 +1,53 @@
|
|||
Initializing the database
|
||||
-------------------------
|
||||
Passerelle provides an uniform access to multiple data sources and services.
|
||||
|
||||
Quickstart
|
||||
==========
|
||||
|
||||
Setting up an environment (virtualenv)
|
||||
--------------------------------------
|
||||
|
||||
The first thing you'll need is the Python virtualenv package. You probably
|
||||
already have this, but if not, you can install it with:
|
||||
|
||||
$ easy_install -UZ virtualenv
|
||||
|
||||
Once that's done, choose a location for the environment, and create it with the
|
||||
virtualenv command. For our guide, we're going to choose "venv" in the current
|
||||
directory:
|
||||
|
||||
$ virtualenv venv
|
||||
$ source venv/bin/activate
|
||||
|
||||
Install required Python packages:
|
||||
|
||||
$ pip install -r requirements.txt
|
||||
|
||||
Initializing the database (quickstart: sqlite3)
|
||||
-----------------------------------------------
|
||||
|
||||
To create the database, execute the following line:
|
||||
|
||||
manage.py --config=config_example.py syncdb --migrate
|
||||
$ python manage.py syncdb --migrate
|
||||
|
||||
The new database is created inside `passerelle.sqlite3` in the
|
||||
current directory.
|
||||
The new database is created inside `passerelle.sqlite3` in the current
|
||||
directory.
|
||||
|
||||
Running
|
||||
-------
|
||||
|
||||
The command line for starting is:
|
||||
|
||||
manage.py --config=config_example.py runserver
|
||||
$ python manage.py runserver
|
||||
|
||||
Passerelle is available on http://127.0.0.1:8000
|
||||
Passerelle is available on http://127.0.0.1:8000/
|
||||
|
||||
Options
|
||||
-------
|
||||
manage.py options
|
||||
-----------------
|
||||
|
||||
--config=/path/to/config.py
|
||||
Configuration file. See config_example.py for example.
|
||||
|
||||
Configuration file. MANDATORY.
|
||||
|
||||
--multitenant
|
||||
|
||||
--multitenant
|
||||
Activate multi-tenant mode. The python-entrouvert package
|
||||
must be installed.
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
pip install --upgrade pip
|
||||
pip install --upgrade pylint
|
||||
pip install --upgrade -r requirements.txt
|
||||
./manage.py --config=config_example.py syncdb --noinput --all
|
||||
./manage.py --config=config_example.py migrate --fake
|
||||
./manage.py --config=config_example.py validate
|
||||
./manage.py syncdb --noinput --all
|
||||
./manage.py migrate --fake
|
||||
./manage.py validate
|
||||
(pylint -f parseable --rcfile /var/lib/jenkins/pylint.django.rc passerelle/ | tee pylint.out) || /bin/true
|
||||
|
||||
|
|
16
manage.py
16
manage.py
|
@ -6,22 +6,24 @@ if __name__ == "__main__":
|
|||
multitenant = False
|
||||
config_file = False
|
||||
|
||||
for i, arg in enumerate(sys.argv[1:]):
|
||||
if arg.startswith('-'):
|
||||
argv = sys.argv[1:]
|
||||
for arg in list(argv):
|
||||
if arg.startswith('--'):
|
||||
if arg.startswith('--config='):
|
||||
config_file = arg.split('=')[1]
|
||||
argv.pop(0)
|
||||
elif arg == '--multitenant':
|
||||
multitenant = True
|
||||
argv.pop(0)
|
||||
else:
|
||||
print >>sys.stderr, 'ERR: Unsupported flag', arg
|
||||
sys.exit(1)
|
||||
else:
|
||||
break
|
||||
if not config_file:
|
||||
print >>sys.stderr, 'ERR: No configuration file specified, use --config=/path/to/config.py'
|
||||
sys.exit(1)
|
||||
|
||||
os.environ['DJANGO_CONFIG_FILE'] = config_file
|
||||
if config_file:
|
||||
os.environ['DJANGO_CONFIG_FILE'] = config_file
|
||||
|
||||
if multitenant:
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "passerelle.tenant_settings")
|
||||
else:
|
||||
|
@ -29,4 +31,4 @@ if __name__ == "__main__":
|
|||
|
||||
from django.core.management import execute_from_command_line
|
||||
|
||||
execute_from_command_line(sys.argv[:1] + sys.argv[i+1:])
|
||||
execute_from_command_line(sys.argv[:1] + argv)
|
||||
|
|
|
@ -15,7 +15,28 @@ logging.getLogger('passerelle').addHandler(NullHandler())
|
|||
|
||||
PACKAGE_PATH = os.path.dirname(__file__)
|
||||
|
||||
LANGUAGE_CODE = 'fr-fr'
|
||||
### Quick-start development settings - unsuitable for production
|
||||
# See https://docs.djangoproject.com/en/dev/howto/deployment/checklist/
|
||||
|
||||
# SECURITY WARNING: keep the secret key used in production secret!
|
||||
SECRET_KEY = 'please-change-me-with-a-very-long-random-string'
|
||||
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = True
|
||||
TEMPLATE_DEBUG = True
|
||||
|
||||
# See https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts
|
||||
ALLOWED_HOSTS = []
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.sqlite3',
|
||||
'NAME': 'passerelle.sqlite3',
|
||||
}
|
||||
}
|
||||
|
||||
### End of "Quick-start development settings"
|
||||
|
||||
|
||||
# If you set this to False, Django will not format dates, numbers and
|
||||
# calendars according to the current locale.
|
||||
|
@ -54,6 +75,7 @@ ROOT_URLCONF = 'passerelle.urls'
|
|||
WSGI_APPLICATION = 'passerelle.wsgi.application'
|
||||
|
||||
LOCALE_PATHS = (os.path.join(PACKAGE_PATH, 'locale'),)
|
||||
LANGUAGE_CODE = 'fr-fr'
|
||||
|
||||
TEMPLATE_DIRS = (os.path.join(PACKAGE_PATH, 'templates'),)
|
||||
|
||||
|
@ -63,32 +85,31 @@ TEMPLATE_CONTEXT_PROCESSORS = global_settings.TEMPLATE_CONTEXT_PROCESSORS + (
|
|||
)
|
||||
|
||||
INSTALLED_APPS = (
|
||||
# system apps
|
||||
'django.contrib.auth',
|
||||
'django.contrib.contenttypes',
|
||||
'django.contrib.sessions',
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
# Uncomment the next line to enable the admin:
|
||||
'django.contrib.admin',
|
||||
# Uncomment the next line to enable admin documentation:
|
||||
# 'django.contrib.admindocs',
|
||||
'south',
|
||||
# base apps
|
||||
'passerelle.base',
|
||||
'passerelle.datasources',
|
||||
'passerelle.repost',
|
||||
'passerelle.messages',
|
||||
'passerelle.register',
|
||||
#'passerelle.queue',
|
||||
# connectors
|
||||
'clicrdv',
|
||||
'gdc',
|
||||
#'solis',
|
||||
#'makorepost',
|
||||
'choosit',
|
||||
'oxyd',
|
||||
'ovh',
|
||||
'mobyt',
|
||||
'pastell',
|
||||
'concerto',
|
||||
'bdp',
|
||||
# backoffice templates and static
|
||||
'gadjo',
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in New Issue