django_example_ynh/local_test.py

33 lines
716 B
Python
Raw Normal View History

2020-12-23 19:53:13 +01:00
"""
2020-12-29 15:04:36 +01:00
Build a "local_test" YunoHost installation and start the Django dev. server against it.
2020-12-28 12:35:36 +01:00
Run via:
make local-test
2020-12-23 19:53:13 +01:00
see README for details ;)
"""
from pathlib import Path
try:
2021-09-15 19:16:35 +02:00
from django_yunohost_integration.local_test import create_local_test
2020-12-23 19:53:13 +01:00
except ImportError as err:
raise ImportError('Did you forget to activate a virtual environment?') from err
2020-12-23 19:53:13 +01:00
BASE_PATH = Path(__file__).parent
2020-12-28 12:35:36 +01:00
2020-12-23 19:53:13 +01:00
def main():
create_local_test(
2020-12-29 11:35:39 +01:00
django_settings_path=BASE_PATH / 'conf' / 'settings.py',
destination=BASE_PATH / 'local_test',
runserver=True,
extra_replacements={
'__DEBUG_ENABLED__': '1',
},
2020-12-23 19:53:13 +01:00
)
if __name__ == '__main__':
main()