Move manage.py to ara.server.__main__ and add an entry point
This moves manage.py inside the package and sets up an "ara-manage" console entry point for doing something like "ara-manage runserver" instead of "python manage.py runserver". Putting this under __main__ also allows users to do "python -m ara.server". Change-Id: I86b57f11fed2fea0295b1980e2734e35289d84f3
This commit is contained in:
parent
1e2a936a18
commit
90ac1acc51
|
@ -2,7 +2,8 @@
|
|||
import os
|
||||
import sys
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
def main():
|
||||
from ara import server
|
||||
|
||||
os.environ.setdefault("ARA_CFG", os.path.dirname(server.__file__) + "/configs/dev.cfg")
|
||||
|
@ -11,3 +12,7 @@ if __name__ == "__main__":
|
|||
from django.core.management import execute_from_command_line
|
||||
|
||||
execute_from_command_line(sys.argv)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -29,6 +29,10 @@ setup-hooks =
|
|||
packages =
|
||||
ara
|
||||
|
||||
[entry_points]
|
||||
console_scripts =
|
||||
ara-manage = ara.server.__main__:main
|
||||
|
||||
[build_sphinx]
|
||||
source-dir = doc/source
|
||||
build-dir = doc/build
|
||||
|
|
12
tox.ini
12
tox.ini
|
@ -21,15 +21,15 @@ commands = sphinx-build -W -b html doc/source doc/build/html
|
|||
commands = {toxinidir}/tests/linters.sh
|
||||
|
||||
[testenv:py3]
|
||||
commands = python manage.py test ara
|
||||
commands = ara-manage test ara
|
||||
setenv =
|
||||
ARA_CFG={toxinidir}/ara/server/configs/test.cfg
|
||||
|
||||
[testenv:runserver]
|
||||
commands =
|
||||
python manage.py migrate
|
||||
python manage.py collectstatic --clear --no-input
|
||||
python manage.py runserver
|
||||
ara-manage migrate
|
||||
ara-manage collectstatic --clear --no-input
|
||||
ara-manage runserver
|
||||
|
||||
# Temporary venv to help bootstrap integration
|
||||
[testenv:ansible-integration]
|
||||
|
@ -49,6 +49,6 @@ whitelist_externals =
|
|||
[testenv:cover]
|
||||
commands =
|
||||
coverage erase
|
||||
coverage run {toxinidir}/manage.py test ara/server
|
||||
coverage run -a {toxinidir}/manage.py test ara/api
|
||||
coverage run {toxinidir}/ara/server/__main__.py test ara/server
|
||||
coverage run -a {toxinidir}/ara/server/__main__.py test ara/api
|
||||
coverage html
|
||||
|
|
Loading…
Reference in New Issue