Hi folks,
I know Django does not do this by default, and I know that by default if you find a package with django-
in its name on PyPi, the chances are that it is a django app.
Are there any examples you might point me to of full django projects on Pypi, that are packaged up as django packages?
My example, as I figure out how I should be doing this
I’m working on one at the link below, where I have an existing software library, and then a bundled directory containing a minimal django project to use the library in API requests. I’m using granian as a bundled web server for a more suitable alternative to the django web server if this needs to be run in production example.
Why use Django like this?
I’m mainly doing this because if I want to expose an HTTP API on a project, I’m more comfortable with Django than other tools like FastAPI and the rest, and I find the ecosystem of supporting packages very helpful in the Django ecosystem.
Projects like NanoDjango also make me feel a bit better about packaging up Django like this for relatively small projects, because it give some idea of what smaller, or even single-file django projects can look like.
The other reason is that if you’re using uv
now, running a Django app could be as simple as calling
uv tool run carbon-txt serve
And if you have it behind a reverse proxy server like Nginx or Caddy, you could theoretically run it in production with something like this invocation (assuming you have a .env file in the same directory):
uv tool run carbon-txt serve --production --server granian
You can see the docs as I’m writing it out. I’ve also written before about using Caddy with Django in this forum, as I think it offers one of the best developer experiences of setting up what can otherwise be quite fiddly.
However, I know that Django has a grain, and I haven’t seen many django projects packaged up onto PyPi to learn from, so I can see what the common patterns are.
So as I said higher up in this post - if you know of any django projects on PyPi, would you share a few links to them?
Ta
As an aside: for those curious about what the above project is about, there’s a fairly in-depth report now online about our plans for carbon.txt, and also a page on the Green Web Foundation website with more info.