Reputation: 10070
I have a Django application which consists of two Django 'apps' - the term used in the Django world for (potentially) reusable packages. My whole application lives in one git repository. I would like to use one of the apps in another Python application. Specifically, I want to use the Django ORM and need to use the models definied in that app. Currently I put the parent directory of the app onto my sys.path
and it works fine. But I would like to be able to pip install
that app.
My directory layout looks like this:
website/
website/ <- main Django app
settings.py
urls.py
...
crawls/ <- app I want to share
views.py
urls.py
pyproject.toml <- this is new
...
other_app/ <- application where I want to use `crawls`
What I tried now is to place a pyproject.toml
into crawls
. However, both hatchling
and flit
seem to insist on an additional subdirectory. For example, the following results in ValueError: No file/folder found for module gen_crawler_crawls
:
[build-system]
requires = ["flit_core >=3.2,<4"]
build-backend = "flit_core.buildapi"
[project]
name = "gen-crawler-crawls"
dependencies = [
"Django>=5.0.6",
]
requires-python = ">=3.12"
authors = [
{name = "Homer Simpson", email = "[email protected]"},
]
dynamic = ["version", "description"]
So, how do I make crawls
into a installable package without adding another directory layer (which would break my main app)? Or is there an alternative way to package this?
Upvotes: 0
Views: 134