I'm trying to package my Django project without success. My project looks like this:
dsbg/
manage.py
dsbg/
__init__.py
urls.py
wsgi.py
app1/
__init__.py
models.py
views.py
urls.py
app2/
__init__.py
models.py
views.py
urls.py
settings/
base.py
local.py
prod.py
static/
app1/
images/
background.gif
style.css
templates/
home.html
app1/
detail.html
index.html
app2/
detail.html
index.html
I followed the procedure here but I'm not sure I'm doing the right things (their example has only one app: polls). I did the following:
- move apps + static + templates directories in new directory django-dsbg (keeping dsbg and settings in root)
- in django-dsbg, create setup.py file, specifying packages files (app1 and app2) and create MANIFEST.in to include static and templates directories.
in django-dsbg, run:
python setup.py sdist
in the parent directory of django-dsbg, run:
pip install --user django-dsbg/dist/django-dsbg-0.1.tar.gz
After that, the project looks like this:
dsbg/
manage.py
settings/
base.py
local.py
prod.py
dsbg/
__init__.py
urls.py
wsgi.py
django-dsbg/
LICENSE
MANIFEST.in
README.rst
app1/
models.py
views.py
urls.py
app2/
models.py
views.py
urls.py
templates/
home.html
app1/
...
app2/
...
static/
...
Now at the root directory (the top dsbg), I try to start the server:
python manage.py runserver --settings=settings.local
The server is starting well but when pointing at localhost, the browser says:
TemplateDoesNotExist at / home.html.
...
Python Path: ['/home/patrick/django/dsbg/dsbg',
...
'/home/patrick/.local/lib/python2.7/site-packages']
This home.html file is located in django-dsbg/templates. Neither dsbg/dsbg nor .local/lib/python2.7/site-packages directories contain home.html. The latter contains all my apps but not the static or the templates directory.
What am I doing wrong? Can someone help me? Any help is greatly appreciated. Patrick