I have a Django app developed as part of my existing Django site that I'd like to separate out and publish on PyPI. What folder structure is required to make the app suitable for publishing to PyPI and importable via pip?
Current folder structure (truncated):
mysite/
- conf/
- mysite/
- __init__.py
- settings.py
- myapp/
- __init__.py
- admin.py
- models.py
- manage.py
Per the Packaging your app section of Advanced tutorial: How to write reusable apps you need to make a new parent folder for your app (outside the Django project) and move your app folder there:
mysite/
- conf/
- mysite/
- __init__.py
- settings.py
- <-- removed here
- manage.py
django-myapp/
- myapp/ <-- inserted here
- __init__.py
- admin.py
- models.py
- setup.py
The folder structure is now publishable. (You still need to add setup.py
and the other files required for PyPI packaging and pip installation.)