Django template not found in main project directory error - python

I am getting a 'template not found' error, although I've set up a correct template hierarchy (or so I thought)
.
├── manage.py
├── twinja
│   ├── admin.py
│   ├── admin.pyc
│   ├── __init__.py
│   ├── __init__.pyc
│   ├── migrations
│   │   ├── __init__.py
│   │   └── __init__.pyc
│   ├── models.py
│   ├── models.pyc
│   ├── tests.py
│   └── views.py
└── twinjasite
├── __init__.py
├── __init__.pyc
├── settings.py
├── settings.py~
├── settings.pyc
├── static
│   └── twinja
│   ├── fonts
│   │   └── bootstrap
│   │   ├── glyphicons-halflings-regular.eot
│   │   ├── glyphicons-halflings-regular.svg
│   │   ├── glyphicons-halflings-regular.ttf
│   │   ├── glyphicons-halflings-regular.woff
│   │   └── glyphicons-halflings-regular.woff2
│   ├── images
│   ├── javascripts
│   │   ├── bootstrap
│   │   │   ├── affix.js
│   │   │   ├── alert.js
│   │   │   ├── button.js
│   │   │   ├── carousel.js
│   │   │   ├── collapse.js
│   │   │   ├── dropdown.js
│   │   │   ├── modal.js
│   │   │   ├── popover.js
│   │   │   ├── scrollspy.js
│   │   │   ├── tab.js
│   │   │   ├── tooltip.js
│   │   │   └── transition.js
│   │   ├── bootstrap.js
│   │   ├── bootstrap.min.js
│   │   └── bootstrap-sprockets.js
│   └── stylesheets
│   ├── framework.css
│   └── styles.css
├── templates
│   └── twinja
│   ├── base.html
│   └── menu.html
├── urls.py
├── urls.py~
├── urls.pyc
├── views.py
├── views.py~
├── views.pyc
├── wsgi.py
└── wsgi.pyc
At first I set up templates/base but that did not work. So I made it as you see here: templates/twinja/base
Ideally I'm setting up the MAIN template files which are independent of apps, which I thought was meant to go in the main folder (where settings.py is) but perhaps I am mistake.
Yes, I have 'twinja' set up in installed apps as well.
What appears to be wrong here?
TemplateDoesNotExist at /
twinja/base.html

If your template is independent of apps, it shouldn't be in your app folder - namespace it accordingly.
How do you load your template? Did you setup your templates/staticfolders in your settings.py?
Updated.
For the fresh project you need to configure your settings.py file. Read here, ask away if you still have a question.
Updated.
After you get familiar with static files and how to manage those, spend some time here.

Related

NotSupportedError at / deterministic=True requires SQLite 3.8.3 or higher

I am trying to deploy a Django application using the default SQLite database to Elastic Beanstalk. The application works fine locally, however, on server, I get the error as :
Any idea what's wrong? Can we not deploy SQLite app on AWS EBS?
Here is my project structure that is getting deployed
├── .ebextensions
│   ├── django.config
├── app
│   ├── __init__.py
│   ├── admin.py
│   ├── apps.py
│   ├── migrations
│   │   ├── 0001_initial.py
│   │   ├── __init__.py
│   ├── models.py
│   ├── static
│   │   └── app
│   │   ├── app.js
│   │   ├── logo.svg
│   │   └── style.css
│   ├── templates
│   │   └── app
│   │   ├── hello.html
│   │   ├── index.html
│   │   └── job_detail.html
│   ├── tests.py
│   ├── urls.py
│   └── views.py
├── db.sqlite3
├── env
│   ├── All Virtual env related files
├── images
│   ├── Photo_on_5-9-14_at_2.31_PM.jpg
│   ├── Photo_on_5-9-14_at_2.32_PM.jpg
│   └── Photo_on_5-9-14_at_2.32_PM_v4McLzE.jpg
├── myproject-test
│   ├── __init__.py
│   ├── asgi.py
│   ├── settings.py
│   ├── urls.py
│   └── wsgi.py
├── manage.py
├── requirements.txt
├── staticfiles
│   |-- All static files collected using collectstatic
│   ├── app
│   │   ├── app.js
│   │   ├── logo.svg
│   │   └── style.css
│   └── subscribe
│   ├── email-icon.png
│   ├── main.css
│   └── main.js
├── subscribe
│   ├── __init__.py
│   ├── admin.py
│   ├── apps.py
│   ├── form.py
│   ├── migrations
│   │   ├── 0001_initial.py
│   │   ├── 0002_subscribe_option_alter_subscribe_email_and_more.py
│   │   ├── 0003_alter_subscribe_option.py
│   ├── models.py
│   ├── static
│   │   └── subscribe
│   │   ├── email-icon.png
│   │   ├── main.css
│   │   └── main.js
│   ├── templates
│   │   └── subscribe
│   │   ├── subscribe.html
│   │   └── thank_you.html
│   ├── tests.py
│   ├── urls.py
│   └── views.py
├── templates
│   └── base.html
├── upload
│   └── images
│   ├── Photo_on_5-9-14_at_2.31_PM.jpg
│   └── Photo_on_5-9-14_at_2.31_PM_3.jpg
└── uploads
├── __init__.py
├── admin.py
├── apps.py
├── forms.py
├── images
│   └── Photo_on_5-9-14_at_2.31_PM_3.jpg
├── migrations
│   ├── 0001_initial.py
│   ├── 0002_uploadfile.py
│   ├── 0003_alter_uploadfile_file.py
│   ├── __init__.py
├── models.py
├── templates
│   └── uploads
│   ├── add_file.html
│   └── add_image.html
├── tests.py
├── urls.py
└── views.py
Deployment process:
Zip all the necessary files
Create AWS EBS application with Python
Add environment variables
Create app and access URL
Please help.

Template not found after deploying to Heroku

After reading through this question, I have some insight as to why when trying to launch my app after deploying to Heroku, I get the following error: raise TemplateNotFound(template), jinja2.exceptions.TemplateNotFound: index.html.
They are saying that the templates should be at the project directory root as shown here. Is there anyway I can modify where Heroku is trying to look for the templates directory? I modified my project structure since my app was growing in size and starting to look a bit unorganized.
Here is a look at my current project structure:
Project
│
├── App
│   ├── DbMs
│   │   ├── db_actions.py
│   │   └── user_operations.py
│   ├── UI
│   │   ├── static
│   │   │   ├── css
│   │   │   │   └── main.css
│   │   │   ├── fonts
│   │   │   │   └── Gotham_Medium_Regular.json
│   │   │   ├── images
│   │   │   │   ├── favicons
│   │   │   │   │   ├── android-chrome-192x192.png
│   │   │   │   │   ├── android-chrome-512x512.png
│   │   │   │   │   ├── apple-touch-icon.png
│   │   │   │   │   ├── favicon-16x16.png
│   │   │   │   │   ├── favicon-32x32.png
│   │   │   │   │   ├── favicon.ico
│   │   │   │   │   └── site.webmanifest
│   │   │   │   ├── header.jpeg
│   │   │   │   ├── logo.png
│   │   │   │   └── radar-chart.png
│   │   │   └── javascript
│   │   │   ├── FontLoader.js
│   │   │   ├── TextGeometry.js
│   │   │   ├── create.js
│   │   │   ├── exploreMusic.js
│   │   │   └── tracks.js
│   │   └── templates
│   │   ├── base.html
│   │   ├── create.html
│   │   ├── index.html
│   │   ├── information.html
│   │   └── tracks.html
│   ├── __init__.py
│   ├── authenticate.py
│   ├── routes.py
│   ├── services.py
│   └── templates
├── Pipfile
├── Procfile
├── README.md
├── Testing
│   ├── __init__.py
│   └── testing.py
├── __pycache__
│   ├── authenticate.cpython-39.pyc
│   ├── config.cpython-39.pyc
│   ├── main.cpython-39.pyc
│   ├── services.cpython-39.pyc
│   └── user_operations.cpython-39.pyc
├── config.py
├── package-lock.json
├── package.json
├── requirements.txt
├── run.py
└── setup.py
For more context, I have everything running perfectly fine locally, I only see this error after deployment. Thanks to anyone who can provide insight.
EDIT: I tried moving the templates folder into the App directory as well as the project root and changing the following line in __init__.py both times:
template_dir = os.path.abspath('../Project/templates/')
After deploying each time, I changed the location of templates, still see the same error from Heroku: raise TemplateNotFound(template) jinja2.exceptions.TemplateNotFound: index.html
So it turns out that Heroku is picky with modifying the location of the templates & static folders.
Whats was very misleading about this issue was that I could run everything fine locally but as soon as I deployed to Heroku, the entire App would break..
The way I fixed this was by moving templates & static into the App directory. I also had to make sure that i changed the following line from:
template_dir = os.path.abspath('../Soulify/App/templates/')
static_dir = os.path.abspath('../Soulify/App/UI/static/')
app = Flask(__name__, template_folder=template_dir, static_folder=static_dir)
to:
app = Flask(__name__)
Also note that the template folder has to be named templates exactly or Heroku will fail. Again, pretty annoying.

How to solve UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte

I'm trying to use Black to format my Django code. It works fine in most directories. However, I get the Unicode decode error UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte on the .py files in one directory in particular. The files are in UTF-8, but I have tried multiple different other encodings and have tried deleting and recreating files which hasn't resolved the issue. I'm working in an Anaconda environment, but deactivating that doesn't make any difference. I've also disabled most of my VS Code extensions.
I have looked at many SO postings on this, but none of the suggestions thus far have helped. I'm using VS Code on a Mac and have a feeling it is something to do with the fact that in the past I have edited the same code on a Windows machine using VS Code with WSL (code synced with a GitHub repo), but can't figure out how to address it. I've put a sample Traceback call below. Any help would be much appreciated!
Edit: If I cut and paste any of the files into another directory, then Black works fine and I don't get any encoding error messages. Which suggests there may be a directory-level issue at play?
(base) ➜ healthtic git:(master) ✗ black pages/views.py
Traceback (most recent call last):
File "/Users/jh/opt/anaconda3/bin/black", line 8, in <module>
sys.exit(patched_main())
File "/Users/jh/opt/anaconda3/lib/python3.8/site-packages/black/__init__.py", line 1130, in patched_main
main()
File "/Users/jh/opt/anaconda3/lib/python3.8/site-packages/click/core.py", line 829, in __call__
return self.main(*args, **kwargs)
File "/Users/jh/opt/anaconda3/lib/python3.8/site-packages/click/core.py", line 782, in main
rv = self.invoke(ctx)
File "/Users/jh/opt/anaconda3/lib/python3.8/site-packages/click/core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Users/jh/opt/anaconda3/lib/python3.8/site-packages/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "/Users/jh/opt/anaconda3/lib/python3.8/site-packages/click/decorators.py", line 21, in new_func
return f(get_current_context(), *args, **kwargs)
File "/Users/jh/opt/anaconda3/lib/python3.8/site-packages/black/__init__.py", line 411, in main
sources = get_sources(
File "/Users/jh/opt/anaconda3/lib/python3.8/site-packages/black/__init__.py", line 477, in get_sources
gitignore = get_gitignore(root)
File "/Users/jh/opt/anaconda3/lib/python3.8/site-packages/black/files.py", line 123, in get_gitignore
lines = gf.readlines()
File "/Users/jh/opt/anaconda3/lib/python3.8/codecs.py", line 322, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte
Further edit: As mentioned above if I move files out of this directory, Black works fine, if I move them back (without any changes), the 0xFF unicode error recurs. I have attached my directory structure below, as it may be relevant that I have webpack and node modules in there for some of the frontend. My impression is that maybe a BOM may be being added somehow in the directory?
├── Dockerfile
├── accounts
│   ├── __init__.py
│   ├── __pycache__
│   ├── admin.py
│   ├── apps.py
│   ├── forms.py
│   ├── migrations
│   ├── models.py
│   ├── tests.py
│   ├── urls.py
│   └── views.py
├── appointments
│   ├── __init__.py
│   ├── __pycache__
│   ├── admin.py
│   ├── apps.py
│   ├── forms.py
│   ├── migrations
│   ├── models.py
│   ├── tests.py
│   ├── urls.py
│   └── views.py
├── cloud_sql_proxy
├── cloudmigrate.yaml
├── config
│   ├── __init__.py
│   ├── __pycache__
│   ├── asgi.py
│   ├── basesettings.py
│   ├── settings.py
│   ├── urls.py
│   └── wsgi.py
├── db.sqlite3
├── docker-compose.yaml
├── front-end
│   ├── App\ copy.js
│   ├── App.js
│   ├── index\ copy.js
│   └── index.js
├── logfile
├── manage.py
├── node_modules
│   ├── #babel
│   ├── #discoveryjs
│   ├── #types
│   ├── #webassemblyjs
│   ├── #webpack-cli
│   ├── #xtuc
│   ├── acorn
│   ├── ajv
│   ├── ajv-keywords
│   ├── ansi-styles
│   ├── babel-loader
│   ├── babel-plugin-dynamic-import-node
│   ├── babel-plugin-polyfill-corejs2
│   ├── babel-plugin-polyfill-corejs3
│   ├── babel-plugin-polyfill-regenerator
│   ├── big.js
│   ├── browserslist
│   ├── buffer-from
│   ├── call-bind
│   ├── caniuse-lite
│   ├── chalk
│   ├── chrome-trace-event
│   ├── clone-deep
│   ├── color-convert
│   ├── color-name
│   ├── colorette
│   ├── commander
│   ├── commondir
│   ├── convert-source-map
│   ├── core-js-compat
│   ├── cross-spawn
│   ├── debug
│   ├── define-properties
│   ├── electron-to-chromium
│   ├── emojis-list
│   ├── enhanced-resolve
│   ├── envinfo
│   ├── es-module-lexer
│   ├── escalade
│   ├── escape-string-regexp
│   ├── eslint-scope
│   ├── esrecurse
│   ├── estraverse
│   ├── esutils
│   ├── events
│   ├── execa
│   ├── fast-deep-equal
│   ├── fast-json-stable-stringify
│   ├── fastest-levenshtein
│   ├── find-cache-dir
│   ├── find-up
│   ├── function-bind
│   ├── gensync
│   ├── get-intrinsic
│   ├── get-stream
│   ├── glob-to-regexp
│   ├── globals
│   ├── graceful-fs
│   ├── has
│   ├── has-flag
│   ├── has-symbols
│   ├── human-signals
│   ├── import-local
│   ├── interpret
│   ├── is-core-module
│   ├── is-plain-object
│   ├── is-stream
│   ├── isexe
│   ├── isobject
│   ├── jest-worker
│   ├── js-tokens
│   ├── jsesc
│   ├── json-parse-better-errors
│   ├── json-schema-traverse
│   ├── json5
│   ├── kind-of
│   ├── loader-runner
│   ├── loader-utils
│   ├── locate-path
│   ├── lodash
│   ├── lodash.debounce
│   ├── loose-envify
│   ├── make-dir
│   ├── merge-stream
│   ├── mime-db
│   ├── mime-types
│   ├── mimic-fn
│   ├── minimist
│   ├── ms
│   ├── neo-async
│   ├── node-releases
│   ├── npm-run-path
│   ├── object-assign
│   ├── object-keys
│   ├── object.assign
│   ├── onetime
│   ├── p-limit
│   ├── p-locate
│   ├── p-try
│   ├── path-exists
│   ├── path-key
│   ├── path-parse
│   ├── pkg-dir
│   ├── punycode
│   ├── randombytes
│   ├── react
│   ├── react-dom
│   ├── rechoir
│   ├── regenerate
│   ├── regenerate-unicode-properties
│   ├── regenerator-runtime
│   ├── regenerator-transform
│   ├── regexpu-core
│   ├── regjsgen
│   ├── regjsparser
│   ├── resolve
│   ├── resolve-cwd
│   ├── resolve-from
│   ├── safe-buffer
│   ├── scheduler
│   ├── schema-utils
│   ├── semver
│   ├── serialize-javascript
│   ├── shallow-clone
│   ├── shebang-command
│   ├── shebang-regex
│   ├── signal-exit
│   ├── source-list-map
│   ├── source-map
│   ├── source-map-support
│   ├── strip-final-newline
│   ├── supports-color
│   ├── tapable
│   ├── terser
│   ├── terser-webpack-plugin
│   ├── to-fast-properties
│   ├── unicode-canonical-property-names-ecmascript
│   ├── unicode-match-property-ecmascript
│   ├── unicode-match-property-value-ecmascript
│   ├── unicode-property-aliases-ecmascript
│   ├── uri-js
│   ├── v8-compile-cache
│   ├── watchpack
│   ├── webpack
│   ├── webpack-cli
│   ├── webpack-merge
│   ├── webpack-sources
│   ├── which
│   ├── wildcard
│   └── yocto-queue
├── notes.md
├── package-lock.json
├── package.json
├── pages
│   ├── __init__.py
│   ├── __pycache__
│   ├── admin.py
│   ├── apps.py
│   ├── migrations
│   ├── models.py
│   ├── tests.py
│   ├── urls.py
│   └── views.py
├── patient
│   ├── __init__.py
│   ├── __pycache__
│   ├── admin.py
│   ├── apps.py
│   ├── migrations
│   ├── models.py
│   ├── serializers.py
│   ├── tests.py
│   ├── urls.py
│   └── views.py
├── patientinfo
│   ├── __init__.py
│   ├── __pycache__
│   ├── admin.py
│   ├── apps.py
│   ├── migrations
│   ├── models.py
│   ├── tests.py
│   ├── urls.py
│   └── views.py
├── readme.md
├── requirements.txt
├── static
│   ├── css
│   ├── images
│   ├── index-bundle.js
│   ├── index-bundle.js.LICENSE.txt
│   └── js-bundle.js
├── staticfiles
│   ├── admin
│   ├── css
│   └── images
├── templates
│   ├── _base.html
│   ├── account
│   ├── appointments
│   ├── frontend.html
│   ├── hello_webpack.html
│   ├── home.html
│   ├── patient
│   └── patientinfo
├── todos.md
└── webpack.config.js
Turns out it was my .gitignore file that was encoded in UTF-16 that was the problem. This seemed to stop Black from working in the whole directory. When I moved all of my files to another directory, I only moved the visible files (so not .gitignore), hence the unusual behaviour. Changing the .gitignore to UTF-8 solved the problem.
I don't even know what django is, but I had the same problem in a non-django program.
In that code fragment was the problem that now is fixed:
open(document.txt, mode= "r", encoding="utf8")
As you can see, the encoding it's utf8, without the "-". I used that code to open documents and read it. I hope it'll be useful!

Importing Static files to template with Django

I'm having trouble loading my CSS file into my HTML template. Below are the invovled files I'm working with. Can anyone see why the CSS wouldn't be loading?
settings.py
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
STATIC_ROOT = 'staticfiles'
STATIC_URL = '/static/'
STATICFILES_DIRS = (
os.path.join(BASE_DIR, 'static'),
)
words.html
{% load staticfiles %}
<link rel="stylesheet" type="text/css" href="{% static 'hello/words.css' %}" />
urls.py
urlpatterns = patterns('',
url(r'^
url(r'^Words', hello.views.index, name='index'),
url(r'^db', hello.views.db, name='db'),
url(r'^Add', hello.views.create, name='create'),
url(r'^admin/', include(admin.site.urls)),
)
urlpatterns += staticfiles_urlpatterns()
words.css
.pri {
color: blue;
}, hello.views.index, name='index'),
Project Structure
murmurwall/
├── Procfile
├── README.md
├── hello
│   ├── __init__.py
│   ├── __init__.pyc
│   ├── __pycache__
│   │   ├── __init__.cpython-34.pyc
│   │   ├── admin.cpython-34.pyc
│   │   ├── forms.cpython-34.pyc
│   │   ├── models.cpython-34.pyc
│   │   └── views.cpython-34.pyc
│   ├── admin.py
│   ├── admin.pyc
│   ├── forms.py
│   ├── forms.pyc
│   ├── management
│   │   └── commands
│   │   ├── CSV
│   │   │   └── Pretty\ Little\ Liars.csv
│   │   ├── __pycache__
│   │   │   └── update_words.cpython-34.pyc
│   │   └── update_words.py
│   ├── models.py
│   ├── models.pyc
│   ├── static
│   │   └── hello
│   │   └── words.css
│   ├── templates
│   │   ├── add_word.html
│   │   ├── base.html
│   │   ├── db.html
│   │   └── words.html
│   ├── tests.py
│   ├── views.py
│   └── views.pyc
├── manage.py
├── murmurwall
│   ├── __init__.py
│   ├── __init__.pyc
│   ├── __pycache__
│   │   ├── __init__.cpython-34.pyc
│   │   ├── settings.cpython-34.pyc
│   │   ├── urls.cpython-34.pyc
│   │   └── wsgi.cpython-34.pyc
│   ├── settings.py
│   ├── settings.pyc
│   ├── static
│   │   └── humans.txt
│   ├── urls.py
│   ├── urls.pyc
│   ├── wsgi.py
│   └── wsgi.pyc
├── requirements.txt
├── runtime.txt
└── staticfiles
├── admin
│   ├── css
│   │   ├── base.css
│   │   ├── changelists.css
│   │   ├── dashboard.css
│   │   ├── forms.css
│   │   ├── ie.css
│   │   ├── login.css
│   │   ├── rtl.css
│   │   └── widgets.css
│   ├── img
│   │   ├── changelist-bg.gif
│   │   ├── changelist-bg_rtl.gif
│   │   ├── default-bg-reverse.gif
│   │   ├── default-bg.gif
│   │   ├── deleted-overlay.gif
│   │   ├── gis
│   │   │   ├── move_vertex_off.png
│   │   │   └── move_vertex_on.png
│   │   ├── icon-no.gif
│   │   ├── icon-unknown.gif
│   │   ├── icon-yes.gif
│   │   ├── icon_addlink.gif
│   │   ├── icon_alert.gif
│   │   ├── icon_calendar.gif
│   │   ├── icon_changelink.gif
│   │   ├── icon_clock.gif
│   │   ├── icon_deletelink.gif
│   │   ├── icon_error.gif
│   │   ├── icon_searchbox.png
│   │   ├── icon_success.gif
│   │   ├── inline-delete-8bit.png
│   │   ├── inline-delete.png
│   │   ├── inline-restore-8bit.png
│   │   ├── inline-restore.png
│   │   ├── inline-splitter-bg.gif
│   │   ├── nav-bg-grabber.gif
│   │   ├── nav-bg-reverse.gif
│   │   ├── nav-bg-selected.gif
│   │   ├── nav-bg.gif
│   │   ├── selector-icons.gif
│   │   ├── selector-search.gif
│   │   ├── sorting-icons.gif
│   │   ├── tooltag-add.png
│   │   └── tooltag-arrowright.png
│   └── js
│   ├── LICENSE-JQUERY.txt
│   ├── SelectBox.js
│   ├── SelectFilter2.js
│   ├── actions.js
│   ├── actions.min.js
│   ├── admin
│   │   ├── DateTimeShortcuts.js
│   │   └── RelatedObjectLookups.js
│   ├── calendar.js
│   ├── collapse.js
│   ├── collapse.min.js
│   ├── core.js
│   ├── inlines.js
│   ├── inlines.min.js
│   ├── jquery.init.js
│   ├── jquery.js
│   ├── jquery.min.js
│   ├── prepopulate.js
│   ├── prepopulate.min.js
│   ├── timeparse.js
│   └── urlify.js
├── hello
│   └── words.css
└── humans.txt
Your STATIC_ROOT = 'staticfiles' need to be the absolute path to the static files. For example STATIC_ROOT = os.path.join(PROJECT_ROOT, STATIC_URL.strip("/")). This might have to be changed for deployment. An example i use for openshift:
if 'OPENSHIFT_REPO_DIR' in os.environ:
STATIC_ROOT = os.path.join(os.environ.get('OPENSHIFT_REPO_DIR'), 'wsgi', 'static')
else:
STATIC_ROOT = os.path.join(PROJECT_ROOT, STATIC_URL.strip("/"))
See also django static static url static root

Django: Application labels aren't unique

I have been working on the issue of duplicate labels in Django and from this answer I have added the following files to my "jobs" project folder:
jobs/apps.py
# jobs/apps.py
from django.apps import AppConfig
class JobsConfig(AppConfig):
name = 'jobs'
verbose_name = "jobs2"
jobs/init.py
# jobs/__init__.py
default_app_config = 'jobs.apps.JobsConfig'
This hasn't really helped much and I still get the error when trying syncdb:
"duplicates: %s" % app_config.label)
django.core.exceptions.ImproperlyConfigured: Application labels aren't unique, duplicates: jobs
Also, changing from "name = 'jobs'" to "name = 'jobs2'" just gives me the error:
ImportError: No module named jobs2
File Structure
/opt/Webapp
├── userfiles
├── templates
│   └── admin
│   └── base.html
├── static
│   ├── admin_tools
│   │   ├── images
│   │   │   └── apto.gif
│   │   └── css
│   │   └── theming.css
│   └── admin
│   └── css
│   └── base.css
├── smartrecruitment
│   ├── wsgi.py
│   ├── urls.py
│   ├── settings.pyc
│   ├── settings.py
│   ├── __init__.pyc
│   └── __init__.py
├── requirements.txt
├── manage.py
├── jobs
│   ├── views.py
│   ├── urls.py
│   ├── tests.py
│   ├── testhelpers.py
│   ├── templates
│   │   └── jobs
│   │   ├── test.html
│   │   ├── success.html
│   │   ├── registration.html
│   │   ├── registrationcomplete.html
│   │   └── application.html
│   ├── tables.py
│   ├── static
│   │   └── jobs
│   │   ├── styles
│   │   │   ├── index.css
│   │   │   ├── hide_admin_original.css
│   │   │   └── application.css
│   │   ├── style.css
│   │   └── images
│   │   └── apto.gif
│   ├── models.py
│   ├── migrations
│   │   ├── __init__.py
│   │   ├── 0002_auto__del_field_registrant_name__add_field_registrant_first_name__add_.py
│   │   └── 0001_initial.py
│   ├── lists.py
│   ├── __init__.pyc
│   ├── __init__.py
│   ├── forms.py
│   ├── apps.pyc
│   ├── apps.py
│   └── admin.py
├── fileuploads
│   ├── tests.py
│   ├── templates
│   │   └── fileuploads
│   │   ├── index.html
│   │   ├── details.html
│   │   ├── base.html
│   │   └── add.html
│   ├── models.pyc
│   ├── models.py
│   ├── __init__.pyc
│   ├── __init__.py
│   ├── forms.pyc
│   ├── forms.py
│   ├── context_processors.py
│   └── admin.pyc
├── dashboard.pyc
└── dashboard.py
You have a mix of old-style (south: 0002_auto_del...) and new-style (django: 0001_initial) migrations in your jobs app. Easiest fix would be to delete all numbered migrations rm jobs/migrations/0???_*.py* and recreate migrations by running manage.py makemigrations

Categories