Django First Aplication [duplicate] - django

This question already has answers here:
Unable to import path from django.urls
(15 answers)
Closed 2 years ago.
After starting python manage.py run server throws such an error, before creating the directory, the server page started correctly.
M:\Project_Django\mysite>python manage.py runserver
Performing system checks...
Unhandled exception in thread started by <function wrapper at 0x043E18F0>
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\django\utils\autoreload.py", line 228, in wrapper
fn(*args, **kwargs)
File "C:\Python27\lib\site-packages\django\core\management\commands\runserver.py", line 124, in inner_run
self.check(display_num_errors=True)
File "C:\Python27\lib\site-packages\django\core\management\base.py", line 359, in check
include_deployment_checks=include_deployment_checks,
File "C:\Python27\lib\site-packages\django\core\management\base.py", line 346, in _run_checks
return checks.run_checks(**kwargs)
File "C:\Python27\lib\site-packages\django\core\checks\registry.py", line 81, in run_checks
new_errors = check(app_configs=app_configs)
File "C:\Python27\lib\site-packages\django\core\checks\urls.py", line 16, in check_url_config
return check_resolver(resolver)
File "C:\Python27\lib\site-packages\django\core\checks\urls.py", line 26, in check_resolver
return check_method()
File "C:\Python27\lib\site-packages\django\urls\resolvers.py", line 256, in check
for pattern in self.url_patterns:
File "C:\Python27\lib\site-packages\django\utils\functional.py", line 35, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "C:\Python27\lib\site-packages\django\urls\resolvers.py", line 407, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "C:\Python27\lib\site-packages\django\utils\functional.py", line 35, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "C:\Python27\lib\site-packages\django\urls\resolvers.py", line 400, in urlconf_module
return import_module(self.urlconf_name)
File "C:\Python27\lib\importlib\__init__.py", line 37, in import_module
__import__(name)
File "M:\Project_Django\mysite\mysite\urls.py", line 17, in <module>
from django.urls import path, include,strona
ImportError: cannot import name path

Last version to suport python 2.7 was django 1.11 which does not have new path syntax, look into proper documentation. also consider updating your Django version, if you are just starting use python 3.* instead

Related

type error module object is not iterable error in django

C:\IT Career\Python\shop>python manage.py runserver
Watching for file changes with StatReloader
Performing system checks...
Exception in thread django-main-thread:
Traceback (most recent call last):
File "C:\Users\THE KING\AppData\Local\Programs\Python\Python39\lib\site-packages\django\urls\resolvers.py", line 600, in url_patterns
iter(patterns)
TypeError: 'module' object is not iterable
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\THE KING\AppData\Local\Programs\Python\Python39\lib\threading.py", line 954, in _bootstrap_inner
self.run()
File "C:\Users\THE KING\AppData\Local\Programs\Python\Python39\lib\threading.py", line 892, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\THE KING\AppData\Local\Programs\Python\Python39\lib\site-packages\django\utils\autoreload.py", line 64, in wrapper
fn(*args, **kwargs)
File "C:\Users\THE KING\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management\commands\runserver.py", line 118, in inner_run
self.check(display_num_errors=True)
File "C:\Users\THE KING\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management\base.py", line 419, in check
all_issues = checks.run_checks(
File "C:\Users\THE KING\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\checks\registry.py", line 76, in run_checks
new_errors = check(app_configs=app_configs, databases=databases)
File "C:\Users\THE KING\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\checks\urls.py", line 13, in check_url_config
return check_resolver(resolver)
File "C:\Users\THE KING\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\checks\urls.py", line 23, in check_resolver
return check_method()
File "C:\Users\THE KING\AppData\Local\Programs\Python\Python39\lib\site-packages\django\urls\resolvers.py", line 413, in check
messages.extend(check_resolver(pattern))
File "C:\Users\THE KING\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\checks\urls.py", line 23, in check_resolver
return check_method()
File "C:\Users\THE KING\AppData\Local\Programs\Python\Python39\lib\site-packages\django\urls\resolvers.py", line 412, in check
for pattern in self.url_patterns:
File "C:\Users\THE KING\AppData\Local\Programs\Python\Python39\lib\site-packages\django\utils\functional.py", line 48, in get
res = instance.dict[self.name] = self.func(instance)
File "C:\Users\THE KING\AppData\Local\Programs\Python\Python39\lib\site-packages\django\urls\resolvers.py", line 607, in url_patterns
raise ImproperlyConfigured(msg.format(name=self.urlconf_name)) from e
django.core.exceptions.ImproperlyConfigured: The included URLconf '<module 'products.urls' from 'C:\IT Career\Python\shop\products\urls.py'>' does not appear to have any
patterns in it. If you see valid patterns in the file then the issue is probably caused by a circular import.
As far as i think you dont have urlpatters in urls.py. There must be a list that contains paths or urls.
Your urls.py should look something like this-:
from django.urls import path, include
from . import views
app_name = "<your_app_name>"
urlpatterns = [
path("your_url", views.your_view),
path("second_url/",views.second_view)]

python django what is the cause of this error

at first server is working but after shange in files this exceptions is come.....
user#user:~/Desktop/mysite$ sudo python manage.py runserver
Performing system checks...
Unhandled exception in thread started by <function wrapper at 0x7f1319ceb668>
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/django/utils/autoreload.py", line 226, in wrapper
fn(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/runserver.py", line 116, in inner_run
self.check(display_num_errors=True)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 426, in check
include_deployment_checks=include_deployment_checks,
File "/usr/local/lib/python2.7/dist-packages/django/core/checks/registry.py", line 75, in run_checks
new_errors = check(app_configs=app_configs)
File "/usr/local/lib/python2.7/dist-packages/django/core/checks/urls.py", line 10, in check_url_config
return check_resolver(resolver)
File "/usr/local/lib/python2.7/dist-packages/django/core/checks/urls.py", line 19, in check_resolver
for pattern in resolver.url_patterns:
File "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py", line 33, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py", line 417, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py", line 33, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py", line 410, in urlconf_module
return import_module(self.urlconf_name)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/home/user/Desktop/mysite/mysite/urls.py", line 22, in <module>
url(r'^webapp/', include('webapp.urls')),
File "/usr/local/lib/python2.7/dist-packages/django/conf/urls/__init__.py", line 52, in include
urlconf_module = import_module(urlconf_module)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/home/user/Desktop/mysite/webapp/urls.py", line 1, in <module>
from django.conf.urls import urls
ImportError: cannot import name urls
I believe you are importing it wrong. Try url not urls. django.conf.urls
from django.conf.urls import url

'cannot import name views' when doing a migration (Django, Python 3.6)

so I am doing a little project for a class with pythonanywhere.com
I am following the instructions given by the teacher, and I entered the following command in the virtualenv console:
python .../manage.py makemigrations
But I have this error message :
'cannot import name views'.
I also had similar error (such as cannot import path, etc...), but I was able to fix them searching on this website. Unfortunately, I didn't find any solution that worked for this particular problem.
So I'd like help to solve it. And I am also wondering if so many issues while trying to make a migration is normal ?
Thank you very much in advance.
Here is the urls.py file that seem to be the problem,
from django.conf.urls import url
from . import views
urlpatterns = [
url('', views.homepage, name='homepage'),
url('user', views.user.list, name='users-list'),
url('<user_id>', views.user.profile, name='user-profile'),
url('listing', views.listing.list, name='listings-list'),
url('<listing_id>', views.listing.profile, name='listing-profile'),
url('currency', views.currency.list, name='currencies-list'),
url('<currency_id>', views.currency.profile, name='currency-profile'),
]
And Here is the full stuff from the virtualenv console.
(django2) 16:28 ~ $ python /home/infosgr37a/project/manage.py makemigrations
Traceback (most recent call last):
File "/home/infosgr37a/project/manage.py", line 15, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 367, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 359, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 305, in run_from_argv
self.execute(*args, **cmd_options)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 353, in execute
self.check()
File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 385, in check
include_deployment_checks=include_deployment_checks,
File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 372, in _run_checks
return checks.run_checks(**kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/core/checks/registry.py", line 81, in run_checks
new_errors = check(app_configs=app_configs)
File "/usr/local/lib/python2.7/dist-packages/django/core/checks/urls.py", line 14, in check_url_config
return check_resolver(resolver)
File "/usr/local/lib/python2.7/dist-packages/django/core/checks/urls.py", line 24, in check_resolver
for pattern in resolver.url_patterns:
File "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py", line 35, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/usr/local/lib/python2.7/dist-packages/django/urls/resolvers.py", line 310, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py", line 35, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/usr/local/lib/python2.7/dist-packages/django/urls/resolvers.py", line 303, in urlconf_module
return import_module(self.urlconf_name)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/home/infosgr37a/project/mysite/urls.py", line 20, in <module>
url('', include('solvaycoin.urls')),
File "/usr/local/lib/python2.7/dist-packages/django/conf/urls/__init__.py", line 50, in include
urlconf_module = import_module(urlconf_module)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/home/infosgr37a/project/solvaycoin/urls.py", line 2, in <module>
from . import views
ImportError: cannot import name views
Full layout :
-Project/
---mysite/
---solvaycoin/
------migrations/
------static/
------templates/
------views/
------__init__.py
------__init__.pyc
------admin.py
------admin.pyc
------apps.py
------apps.pyc
------models.py
------models.pyc
------urls.py
------urls.pyc
---manage.py
So 'views' is a folder.
I hope this is clear enough, I didn't know how to do it properly.
Edit:
Tried what Babu recommended, and it got me post the 'view' problem.
But now I have another one:
(django2) 18:51 ~ $ python /home/infosgr37a/project/manage.py makemigrations
Traceback (most recent call last):
File "/home/infosgr37a/project/manage.py", line 15, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 367, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 359, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 305, in run_from_argv
self.execute(*args, **cmd_options)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 353, in execute
self.check()
File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 385, in check
include_deployment_checks=include_deployment_checks,
File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 372, in _run_checks
return checks.run_checks(**kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/core/checks/registry.py", line 81, in run_checks
new_errors = check(app_configs=app_configs)
File "/usr/local/lib/python2.7/dist-packages/django/core/checks/urls.py", line 14, in check_url_config
return check_resolver(resolver)
File "/usr/local/lib/python2.7/dist-packages/django/core/checks/urls.py", line 24, in check_resolver
for pattern in resolver.url_patterns:
File "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py", line 35, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/usr/local/lib/python2.7/dist-packages/django/urls/resolvers.py", line 310, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py", line 35, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/usr/local/lib/python2.7/dist-packages/django/urls/resolvers.py", line 303, in urlconf_module
return import_module(self.urlconf_name)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/home/infosgr37a/project/mysite/urls.py", line 20, in <module>
url('', include('solvaycoin.urls')),
File "/usr/local/lib/python2.7/dist-packages/django/conf/urls/__init__.py", line 50, in include
urlconf_module = import_module(urlconf_module)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/home/infosgr37a/project/solvaycoin/urls.py", line 5, in <module>
url('user', views.user.list, name='users-list'),
AttributeError: 'module' object has no attribute 'user'
Is it because I moved my views to a single file ?
There is no views.py in your solvaycoin application folder. Create views.py in your solvaycoin folder Paste your functions and class ('homepage', user.list, user.profile, listing.list, listing.profile, currency.list, currency.profile) inside that view.py file. Hope It Works.............!!!!!!!

cannot import name patterns - django

I am using Visual Studio 2013, and, Python Tools for VS 2013 to get started with a Django website.
It gives the following error,
Full traceback
Performing system checks...
Traceback (most recent call last):
File "c:\users\my_username\documents\visual studio 2013\Projects\DjangoWebProject
1\DjangoWebProject1\manage.py", line 17, in <module>
execute_from_command_line(sys.argv)
File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line
367, in execute_from_command_line
utility.execute()
File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line
359, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Python27\lib\site-packages\django\core\management\base.py", line 294,
in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Python27\lib\site-packages\django\core\management\commands\runserver.
py", line 58, in execute
super(Command, self).execute(*args, **options)
File "C:\Python27\lib\site-packages\django\core\management\base.py", line 345,
in execute
output = self.handle(*args, **options)
File "C:\Python27\lib\site-packages\django\core\management\commands\runserver.
py", line 97, in handle
self.run(**options)
File "C:\Python27\lib\site-packages\django\core\management\commands\runserver.
py", line 108, in run
self.inner_run(None, **options)
File "C:\Python27\lib\site-packages\django\core\management\commands\runserver.
py", line 121, in inner_run
self.check(display_num_errors=True)
File "C:\Python27\lib\site-packages\django\core\management\base.py", line 374,
in check
include_deployment_checks=include_deployment_checks,
File "C:\Python27\lib\site-packages\django\core\management\base.py", line 361,
in _run_checks
return checks.run_checks(**kwargs)
File "C:\Python27\lib\site-packages\django\core\checks\registry.py", line 81,
in run_checks
new_errors = check(app_configs=app_configs)
File "C:\Python27\lib\site-packages\django\core\checks\urls.py", line 14, in c
heck_url_config
return check_resolver(resolver)
File "C:\Python27\lib\site-packages\django\core\checks\urls.py", line 24, in c
heck_resolver
for pattern in resolver.url_patterns:
File "C:\Python27\lib\site-packages\django\utils\functional.py", line 35, in _
_get__
res = instance.__dict__[self.name] = self.func(instance)
File "C:\Python27\lib\site-packages\django\urls\resolvers.py", line 313, in ur
l_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "C:\Python27\lib\site-packages\django\utils\functional.py", line 35, in _
_get__
res = instance.__dict__[self.name] = self.func(instance)
File "C:\Python27\lib\site-packages\django\urls\resolvers.py", line 306, in ur
lconf_module
return import_module(self.urlconf_name)
File "C:\Python27\lib\importlib\__init__.py", line 37, in import_module
__import__(name)
File "c:\users\my_username\documents\visual studio 2013\Projects\DjangoWebProject
1\DjangoWebProject1\DjangoWebProject1\urls.py", line 6, in <module>
from django.conf.urls import patterns, url
ImportError: cannot import name patterns
Press any key to continue . . .
How can I fix this?
patterns was removed in Django 1.10. Instead, use a regular list:
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^articles/2003/$', views.special_case_2003),
url(r'^articles/([0-9]{4})/$', views.year_archive),
url(r'^articles/([0-9]{4})/([0-9]{2})/$', views.month_archive),
url(r'^articles/([0-9]{4})/([0-9]{2})/([0-9]+)/$', views.article_detail),
]
Refer to the docs for more info.

Why do i have 'relation does not exist' when just running 'makemigrations'?

Django-based project made use of Django 1.6 and now needs upgrade to 1.9. So i just renamed South's 'migrations' folders to 'south_migrations', created 'migrations' folder with init.py in each app that is in INSTALLED_APPS, upgraded all requirements of a project and made changes to code so it would be Django1.9-compatible. Now i want to create native Django migrations running 'makemigrations' but getting this traceback:
Traceback (most recent call last):
File "/home/nervosa/Apps/pycharm-2016.1/helpers/pycharm/django_manage.py", line 41, in <module>
run_module(manage_file, None, '__main__', True)
File "/usr/lib/python2.7/runpy.py", line 176, in run_module
fname, loader, pkg_name)
File "/usr/lib/python2.7/runpy.py", line 82, in _run_module_code
mod_name, mod_fname, mod_loader, pkg_name)
File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/home/nervosa/DjangoProjects/iticket/manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/nervosa/DjangoProjects/virtualenvs/iticket_venv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 353, in execute_from_command_line
utility.execute()
File "/home/nervosa/DjangoProjects/virtualenvs/iticket_venv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 345, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/nervosa/DjangoProjects/virtualenvs/iticket_venv/local/lib/python2.7/site-packages/django/core/management/base.py", line 348, in run_from_argv
self.execute(*args, **cmd_options)
File "/home/nervosa/DjangoProjects/virtualenvs/iticket_venv/local/lib/python2.7/site-packages/django/core/management/base.py", line 398, in execute
self.check()
File "/home/nervosa/DjangoProjects/virtualenvs/iticket_venv/local/lib/python2.7/site-packages/django/core/management/base.py", line 426, in check
include_deployment_checks=include_deployment_checks,
File "/home/nervosa/DjangoProjects/virtualenvs/iticket_venv/local/lib/python2.7/site-packages/django/core/checks/registry.py", line 75, in run_checks
new_errors = check(app_configs=app_configs)
File "/home/nervosa/DjangoProjects/virtualenvs/iticket_venv/local/lib/python2.7/site-packages/django/core/checks/urls.py", line 13, in check_url_config
return check_resolver(resolver)
File "/home/nervosa/DjangoProjects/virtualenvs/iticket_venv/local/lib/python2.7/site-packages/django/core/checks/urls.py", line 23, in check_resolver
for pattern in resolver.url_patterns:
File "/home/nervosa/DjangoProjects/virtualenvs/iticket_venv/local/lib/python2.7/site-packages/django/utils/functional.py", line 33, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/home/nervosa/DjangoProjects/virtualenvs/iticket_venv/local/lib/python2.7/site-packages/django/core/urlresolvers.py", line 417, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/home/nervosa/DjangoProjects/virtualenvs/iticket_venv/local/lib/python2.7/site-packages/django/utils/functional.py", line 33, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/home/nervosa/DjangoProjects/virtualenvs/iticket_venv/local/lib/python2.7/site-packages/django/core/urlresolvers.py", line 410, in urlconf_module
return import_module(self.urlconf_name)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/home/nervosa/DjangoProjects/iticket/iticket/urls.py", line 7, in <module>
from frontend.views import ReturnPaymentURL
File "/home/nervosa/DjangoProjects/iticket/frontend/views.py", line 19, in <module>
from cases.forms import SelfTrafficForm, SelfStartTrafficForm, PJCForm
File "/home/nervosa/DjangoProjects/iticket/cases/forms.py", line 269, in <module>
class SelfTrafficForm(forms.ModelForm):
File "/home/nervosa/DjangoProjects/iticket/cases/forms.py", line 271, in SelfTrafficForm
counties = [(x.pk, x.county.title()) for x in County.objects.all()]
File "/home/nervosa/DjangoProjects/virtualenvs/iticket_venv/local/lib/python2.7/site-packages/django/db/models/query.py", line 258, in __iter__
self._fetch_all()
File "/home/nervosa/DjangoProjects/virtualenvs/iticket_venv/local/lib/python2.7/site-packages/django/db/models/query.py", line 1074, in _fetch_all
self._result_cache = list(self.iterator())
File "/home/nervosa/DjangoProjects/virtualenvs/iticket_venv/local/lib/python2.7/site-packages/django/db/models/query.py", line 52, in __iter__
results = compiler.execute_sql()
File "/home/nervosa/DjangoProjects/virtualenvs/iticket_venv/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 848, in execute_sql
cursor.execute(sql, params)
File "/home/nervosa/DjangoProjects/virtualenvs/iticket_venv/local/lib/python2.7/site-packages/django/db/backends/utils.py", line 79, in execute
return super(CursorDebugWrapper, self).execute(sql, params)
File "/home/nervosa/DjangoProjects/virtualenvs/iticket_venv/local/lib/python2.7/site-packages/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
File "/home/nervosa/DjangoProjects/virtualenvs/iticket_venv/local/lib/python2.7/site-packages/django/db/utils.py", line 95, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/home/nervosa/DjangoProjects/virtualenvs/iticket_venv/local/lib/python2.7/site-packages/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
django.db.utils.ProgrammingError: relation "places_county" does not exist
LINE 1: ...."main_attorney_id", "places_county"."ds_id" FROM "places_co...
^
When running for separate app, e.g. 'makemigrations billing' i get just the same output. I'm kinda puzzled because even Django's tables aren't created!!!
What is the best way to overcome this?
Your TrafficForm is doing something it shouldn't, which is querying the County objects at import time. While you had an existing database, this was OK(*), but now that you're starting from scratch it will complain.
You should change that form to use ModelChoiceField.
(*) it's almost always a bad idea to do this anyway, because new objects won't be visible in that field until the process is restarted; but in your case I guess new County objects are not often created.