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
7
manage.py → ara/server/__main__.py
Executable file → Normal file
7
manage.py → ara/server/__main__.py
Executable file → Normal file
@ -2,7 +2,8 @@
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
|
def main():
|
||||||
from ara import server
|
from ara import server
|
||||||
|
|
||||||
os.environ.setdefault("ARA_CFG", os.path.dirname(server.__file__) + "/configs/dev.cfg")
|
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
|
from django.core.management import execute_from_command_line
|
||||||
|
|
||||||
execute_from_command_line(sys.argv)
|
execute_from_command_line(sys.argv)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
@ -29,6 +29,10 @@ setup-hooks =
|
|||||||
packages =
|
packages =
|
||||||
ara
|
ara
|
||||||
|
|
||||||
|
[entry_points]
|
||||||
|
console_scripts =
|
||||||
|
ara-manage = ara.server.__main__:main
|
||||||
|
|
||||||
[build_sphinx]
|
[build_sphinx]
|
||||||
source-dir = doc/source
|
source-dir = doc/source
|
||||||
build-dir = doc/build
|
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
|
commands = {toxinidir}/tests/linters.sh
|
||||||
|
|
||||||
[testenv:py3]
|
[testenv:py3]
|
||||||
commands = python manage.py test ara
|
commands = ara-manage test ara
|
||||||
setenv =
|
setenv =
|
||||||
ARA_CFG={toxinidir}/ara/server/configs/test.cfg
|
ARA_CFG={toxinidir}/ara/server/configs/test.cfg
|
||||||
|
|
||||||
[testenv:runserver]
|
[testenv:runserver]
|
||||||
commands =
|
commands =
|
||||||
python manage.py migrate
|
ara-manage migrate
|
||||||
python manage.py collectstatic --clear --no-input
|
ara-manage collectstatic --clear --no-input
|
||||||
python manage.py runserver
|
ara-manage runserver
|
||||||
|
|
||||||
# Temporary venv to help bootstrap integration
|
# Temporary venv to help bootstrap integration
|
||||||
[testenv:ansible-integration]
|
[testenv:ansible-integration]
|
||||||
@ -49,6 +49,6 @@ whitelist_externals =
|
|||||||
[testenv:cover]
|
[testenv:cover]
|
||||||
commands =
|
commands =
|
||||||
coverage erase
|
coverage erase
|
||||||
coverage run {toxinidir}/manage.py test ara/server
|
coverage run {toxinidir}/ara/server/__main__.py test ara/server
|
||||||
coverage run -a {toxinidir}/manage.py test ara/api
|
coverage run -a {toxinidir}/ara/server/__main__.py test ara/api
|
||||||
coverage html
|
coverage html
|
||||||
|
Loading…
Reference in New Issue
Block a user