Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pip-installable and runnable aileen-core #5

Open
nhoening opened this issue Jul 8, 2019 · 1 comment
Open

pip-installable and runnable aileen-core #5

nhoening opened this issue Jul 8, 2019 · 1 comment

Comments

@nhoening
Copy link
Contributor

nhoening commented Jul 8, 2019

When running an aileen- use case on an Aileen box, one should not have to downlaod aileen-core manually. It should be a pip dependency.

The issue to solve is that we need to run manage.py. Either we

  • make a function, which aileen-core's setup.py installs as an entry point: https://lincolnloop.com/blog/goodbye-managepy/ Better even: Make two, one only for run_box, one for stop_box. I did not succeed with this due to some path problems, but it seems possible. Maybe we aren't using the best way to import code. The Django coding style says to use "relative imports for local components"
  • Make a script which will go to the installation directory (https://stackoverflow.com/questions/122327/how-do-i-find-the-location-of-my-python-site-packages-directory) and then call manage.py from there. I guess we'll have to make sure an .env file will be read in before we change to that directory. Also we should change back when that script ends. This solution feels a little more inconvenient.
@nhoening
Copy link
Contributor Author

nhoening commented Jul 8, 2019

For method one: If I follow the lincolnloop example, then the python inerpreter operates one level higher, i.e. aileen.aileen.settings can be imported, but aileen.settings cannot. This has an effect of dicsovering the apps, as well, so both this approach and the usual usage of manage.py don't go together (manage.py is "in" aileen and can import the apps directly, i.e. data, box, server.
This is weird because __init__.py and manage.py are basically the same code. The difference is thus how setup.py's entry_points "sees" where it operates. We define:

entry_points={'console_scripts': [
    'aileen_start_box = aileen:run_box',
]}

where run_box is in the __init__.py next to manage.py. So the extra level is visible here. I tried adding

os.chdir("aileen")

but it takes more than that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant