0

I'm developing a new Django site. It uses some existing Django apps and I'm building some of my own.

Current folder structure (truncated):

projects/
- mysite/
  - .git/
  - conf/
  - mysite/
    - __init__.py
    - settings.py
  - myapp/
    - __init__.py
    - admin.py
    - models.py
  - manage.py

I'd like to make my site and apps available as separate Git repositories. In other words, someone may want to clone/contribute to the whole site, or they may want to clone/contribute to just an app.

According to the Packaging your app section of Advanced tutorial: How to write reusable apps the following folder structure is required for separate site and app folders:

projects/
- mysite/
  - .git/
  - conf/
  - mysite/
    - __init__.py
    - settings.py
  - manage.py
- django-myapp
  - .git/
  - myapp/
    - __init__.py
    - admin.py
    - models.py
  - setup.py

But in Using your own package the same tutorial suggests that the only way to make and use local modifications is to:

  1. Modify the app folder
  2. Run python setup.py sdist to build the app
  3. Run pip install --user /path/to/django-myapp.tar.gz to install it
  4. Run the Django site

How can I organise these folders so that I can easily modify either site or app code, and immediately run the site locally? In other words, avoid building and importing a local tarball each time.

lofidevops
  • 15,528
  • 14
  • 79
  • 119

1 Answers1

0

My naive reading is that the following (untested) structure should work, with myapp excluded from the virtualenv used to run the site locally...

projects/
- mysite/
  - .git/
  - conf/
  - mysite/
    - __init__.py
    - settings.py
  - myapp/ --> symlink to projects/django-myapp/myapp
  - .gitignore --> ignores myapp/
  - manage.py
- django-myapp
  - .git/
  - myapp/
    - __init__.py
    - admin.py
    - models.py
  - setup.py

Obviously releases should be tested and coordinated carefully, so that released versions and published dependencies work together correctly.

lofidevops
  • 15,528
  • 14
  • 79
  • 119