django 1.9, migrations SUCK
Hi, I am dev in django at last 4 years, i missed ./manage.py syncdb, Delete all tables from databases (MariaDB, PostgreSQL) command line from DB, and run python manage.py migrate always same error *python manage.py migrate* django.db.utils.ProgrammingError: (1146, "Table 'dashaboard_web.did_didcountry' doesn't exist") *python manage.py migrate did* django.db.utils.ProgrammingError: (1146, "Table 'dashaboard_web.did_didcountry' doesn't exist") *python manage.py makemigrations* django.db.utils.ProgrammingError: (1146, "Table 'dashaboard_web.did_didcountry' doesn't exist") *python manage.py sqlmigrate did 0001* django.db.utils.ProgrammingError: (1146, "Table 'dashaboard_web.did_didcountry' doesn't exist") *python manage.py migrate --run-syncdb* django.db.utils.ProgrammingError: (1146, "Table 'dashaboard_web.did_didcountry' doesn't exist") if the tables doesn't exist, why create table new ??? as, create new tables run command python manage.py migrate ?? -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/385e00d8-bfc0-44a5-90b4-aad0aa1fd9eb%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: django 1.9, migrations SUCK
On Fri, Jul 29, 2016 at 07:02:44AM -0700, Jorge Cadena wrote: > Hi, > > I am dev in django at last 4 years, i missed ./manage.py syncdb, > > Delete all tables from databases (MariaDB, PostgreSQL) command line from > DB, and run python manage.py migrate always same error > > *python manage.py migrate* > django.db.utils.ProgrammingError: (1146, "Table > 'dashaboard_web.did_didcountry' doesn't exist") > > *python manage.py migrate did* > django.db.utils.ProgrammingError: (1146, "Table > 'dashaboard_web.did_didcountry' doesn't exist") > > *python manage.py makemigrations* > django.db.utils.ProgrammingError: (1146, "Table > 'dashaboard_web.did_didcountry' doesn't exist") > > *python manage.py sqlmigrate did 0001* > django.db.utils.ProgrammingError: (1146, "Table > 'dashaboard_web.did_didcountry' doesn't exist") > > *python manage.py migrate --run-syncdb* > django.db.utils.ProgrammingError: (1146, "Table > 'dashaboard_web.did_didcountry' doesn't exist") > > > if the tables doesn't exist, why create table new ??? > as, create new tables run command python manage.py migrate ?? If you're getting errors about missing database tables even when you run manage.py makemigrations, then that would mean you'll get that same error every time you run manage.py, regardless of what command you run. makemigrations does not access the database, it only inspects existing migration files, and compares them to the current model definitions. The error you are getting is most likely because you're accessing the database on import (i.e. somewhere at module level you are making database queries). If that is indeed the case, then you would get the exact same error even with the old syncdb. However, it is hard to tell for sure, since you have not provided the full traceback. Cheers, Michal -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/20160729142428.GX16002%40konk.org. For more options, visit https://groups.google.com/d/optout. signature.asc Description: Digital signature
Re: django 1.9, migrations SUCK
same error, in mariaDB, postgresql, rigth now in sqlite3 El viernes, 29 de julio de 2016, 9:07:33 (UTC-5), Jorge Cadena escribió: > > Hi, > > I am dev in django at last 4 years, i missed ./manage.py syncdb, > > Delete all tables from databases (MariaDB, PostgreSQL) command line from > DB, and run python manage.py migrate always same error > > *python manage.py migrate* > django.db.utils.ProgrammingError: (1146, "Table > 'dashaboard_web.did_didcountry' doesn't exist") > > *python manage.py migrate did* > django.db.utils.ProgrammingError: (1146, "Table > 'dashaboard_web.did_didcountry' doesn't exist") > > *python manage.py makemigrations* > django.db.utils.ProgrammingError: (1146, "Table > 'dashaboard_web.did_didcountry' doesn't exist") > > *python manage.py sqlmigrate did 0001* > django.db.utils.ProgrammingError: (1146, "Table > 'dashaboard_web.did_didcountry' doesn't exist") > > *python manage.py migrate --run-syncdb* > django.db.utils.ProgrammingError: (1146, "Table > 'dashaboard_web.did_didcountry' doesn't exist") > > > if the tables doesn't exist, why create table new ??? > as, create new tables run command python manage.py migrate ?? > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/f9ab505a-7bd7-4e85-8759-9a211c388154%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: django 1.9, migrations SUCK
Traceback (most recent call last): File "manage.py", line 10, in execute_from_command_line(sys.argv) File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 353, in execute_from_command_line utility.execute() File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 345, 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 348, in run_from_argv self.execute(*args, **cmd_options) File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 398, in execute self.check() 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 13, in check_url_config return check_resolver(resolver) File "/usr/local/lib/python2.7/dist-packages/django/core/checks/urls.py", line 23, 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/ariatel_web/dashboard.ariatel.com.co/dashaboar_ariatel/urls.py", line 20, in from apps.did.views import CountryViewSet, AreasViewSet File "/home/ariatel_web/dashboard.ariatel.com.co/apps/did/views.py", line 15, in from .forms import BuySearchForm File "/home/ariatel_web/dashboard.ariatel.com.co/apps/did/forms.py", line 11, in class BuySearchForm(forms.Form): File "/home/ariatel_web/dashboard.ariatel.com.co/apps/did/forms.py", line 12, in BuySearchForm country = forms.ChoiceField(choices=[ (d.country_name, d.country_name) for d in DidCountry.objects.filter(is_active=True) ], required=False) File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 258, in __iter__ self._fetch_all() File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 1074, in _fetch_all self._result_cache = list(self.iterator()) File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 52, in __iter__ results = compiler.execute_sql() File "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py", line 848, in execute_sql cursor.execute(sql, params) File "/usr/local/lib/python2.7/dist-packages/django/db/backends/utils.py", line 79, in execute return super(CursorDebugWrapper, self).execute(sql, params) File "/usr/local/lib/python2.7/dist-packages/django/db/backends/utils.py", line 64, in execute return self.cursor.execute(sql, params) File "/usr/local/lib/python2.7/dist-packages/django/db/utils.py", line 95, in __exit__ six.reraise(dj_exc_type, dj_exc_value, traceback) File "/usr/local/lib/python2.7/dist-packages/django/db/backends/utils.py", line 64, in execute return self.cursor.execute(sql, params) File "/usr/local/lib/python2.7/dist-packages/django/db/backends/sqlite3/base.py", line 323, in execute return Database.Cursor.execute(self, query, params) django.db.utils.OperationalError: no such table: did_didcountry El viernes, 29 de julio de 2016, 9:44:05 (UTC-5), Jorge Cadena escribió: > > same error, in mariaDB, postgresql, rigth now in sqlite3 > > > El viernes, 29 de julio de 2016, 9:07:33 (UTC-5), Jorge Cadena escribió: >> >> Hi, >> >> I am dev in django at last 4 years, i missed ./manage.py syncdb, >> >> Delete all tables from databases (MariaDB, PostgreSQL) command line from >> DB, and run python manage.py migrate always same error >> >> *python manage.py migrate* >> django.db.utils.ProgrammingError: (1146, "Table >> 'dashaboard_web.did_didcountry' doesn't exist") >> >> *python manage.py migrate did* >> django.db.utils.ProgrammingError: (1146, "Table >> 'dashaboard_web.did_didcountry' doesn't exist") >> >> *python manage.py makemigrations* >> django.db.utils.ProgrammingError: (1146, "Table >> 'dashaboard_web.did_didcountry' doesn't exist") >> >> *python manage.py sqlmigrate did 0001* >> django.db.utils.ProgrammingError: (1146, "Table >> 'dashaboa
Re: django 1.9, migrations
On Fri, Jul 29, 2016, Jorge Cadena wrote: >I am dev in django at last 4 years, i missed ./manage.py syncdb, Please change your email subject to something more polite. You have a good chance to get expert help here from people, including perhaps people who helped create the Django migrations system - don't be rude about it. Daniele -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/20160729151611.1391620346%40mail.wservices.ch. For more options, visit https://groups.google.com/d/optout.
Re: django 1.9, migrations certainly don't suck
On Fri, Jul 29, 2016 at 08:01:05AM -0700, Jorge Cadena wrote: > > > Traceback (most recent call last): > File "manage.py", line 10, in > execute_from_command_line(sys.argv) > File > "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", > line 353, in execute_from_command_line > utility.execute() > File > "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", > line 345, 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 > 348, in run_from_argv > self.execute(*args, **cmd_options) > File > "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line > 398, in execute > self.check() > 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 13, in check_url_config > return check_resolver(resolver) > File "/usr/local/lib/python2.7/dist-packages/django/core/checks/urls.py", > line 23, 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/ariatel_web/dashboard.ariatel.com.co/dashaboar_ariatel/urls.py", line > 20, in > from apps.did.views import CountryViewSet, AreasViewSet > File "/home/ariatel_web/dashboard.ariatel.com.co/apps/did/views.py", line > 15, in > from .forms import BuySearchForm > File "/home/ariatel_web/dashboard.ariatel.com.co/apps/did/forms.py", line > 11, in > class BuySearchForm(forms.Form): > File "/home/ariatel_web/dashboard.ariatel.com.co/apps/did/forms.py", line > 12, in BuySearchForm > country = forms.ChoiceField(choices=[ (d.country_name, d.country_name) > for d in DidCountry.objects.filter(is_active=True) ], required=False) This line here is the problem – you should never evaluate querysets at module level, in this case you should either use a function as the choices argument to ChoiceField, or use a ModelChoiceField. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/20160729151636.GY16002%40konk.org. For more options, visit https://groups.google.com/d/optout. signature.asc Description: Digital signature
Re: django 1.9, migrations SUCK
File "/home/ariatel_web/dashboard.ariatel.com.co/apps/did/forms.py", line 12, in BuySearchForm country = forms.ChoiceField(choices=[ (d.country_name, d.country_name) for d in DidCountry.objects.filter(is_active=True) ], required=False) Theres your problem, you are trying to query the database when it's empty On Fri, Jul 29, 2016 at 11:01 AM, Jorge Cadena wrote: > > Traceback (most recent call last): > File "manage.py", line 10, in > execute_from_command_line(sys.argv) > File > "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", > line 353, in execute_from_command_line > utility.execute() > File > "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", > line 345, 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 > 348, in run_from_argv > self.execute(*args, **cmd_options) > File > "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line > 398, in execute > self.check() > 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 13, in check_url_config > return check_resolver(resolver) > File "/usr/local/lib/python2.7/dist-packages/django/core/checks/urls.py", > line 23, 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/ariatel_web/dashboard.ariatel.com.co/dashaboar_ariatel/urls.py", line > 20, in > from apps.did.views import CountryViewSet, AreasViewSet > File "/home/ariatel_web/dashboard.ariatel.com.co/apps/did/views.py", line > 15, in > from .forms import BuySearchForm > File "/home/ariatel_web/dashboard.ariatel.com.co/apps/did/forms.py", line > 11, in > class BuySearchForm(forms.Form): > File "/home/ariatel_web/dashboard.ariatel.com.co/apps/did/forms.py", line > 12, in BuySearchForm > country = forms.ChoiceField(choices=[ (d.country_name, d.country_name) > for d in DidCountry.objects.filter(is_active=True) ], required=False) > File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", > line 258, in __iter__ > self._fetch_all() > File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", > line 1074, in _fetch_all > self._result_cache = list(self.iterator()) > File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", > line 52, in __iter__ > results = compiler.execute_sql() > File > "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py", > line 848, in execute_sql > cursor.execute(sql, params) > File "/usr/local/lib/python2.7/dist-packages/django/db/backends/utils.py", > line 79, in execute > return super(CursorDebugWrapper, self).execute(sql, params) > File "/usr/local/lib/python2.7/dist-packages/django/db/backends/utils.py", > line 64, in execute > return self.cursor.execute(sql, params) > File "/usr/local/lib/python2.7/dist-packages/django/db/utils.py", line 95, > in __exit__ > six.reraise(dj_exc_type, dj_exc_value, traceback) > File "/usr/local/lib/python2.7/dist-packages/django/db/backends/utils.py", > line 64, in execute > return self.cursor.execute(sql, params) > File > "/usr/local/lib/python2.7/dist-packages/django/db/backends/sqlite3/base.py", > line 323, in execute > return Database.Cursor.execute(self, query, params) > django.db.utils.OperationalError: no such table: did_didcountry > > > El viernes, 29 de julio de 2016, 9:44:05 (UTC-5), Jorge Cadena escribió: >> >> same error, in mariaDB, postgresql, rigth now in sqlite3 >> >> >> El viernes, 29 de julio de 2016, 9:07:33 (UTC-5), Jorge Cadena escribió: >>> >>> Hi, >>> >>> I am dev in django at last 4 years, i missed ./manage.py syncdb, >>> >>> Delete all tables from databases (MariaDB, PostgreSQL) command line from >>> DB, a
Re: django 1.9, migrations SUCK
In /home/ariatel_web/dashboard.ariatel.com.co/apps/did/forms.py, replacing country = forms.ChoiceField(choices=[ (d.country_name, d.country_name) for d in DidCountry.objects.filter(is_active=True) ] with country = forms.ChoiceField(choices=lambda: [ (d.country_name, d.country_name) for d in DidCountry.objects.filter(is_active=True) ] should do the trick. It will make the choices arguments a callable which will be evaluated when the form is used for the first time, not when the module is imported. 2016-07-29 17:01 GMT+02:00 Jorge Cadena : > > Traceback (most recent call last): > File "manage.py", line 10, in > execute_from_command_line(sys.argv) > File > "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", > line 353, in execute_from_command_line > utility.execute() > File > "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", > line 345, 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 348, in run_from_argv > self.execute(*args, **cmd_options) > File > "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", > line 398, in execute > self.check() > 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 13, in check_url_config > return check_resolver(resolver) > File "/usr/local/lib/python2.7/dist-packages/django/core/checks/urls.py", > line 23, 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/ariatel_web/dashboard.ariatel.com.co/dashaboar_ariatel/urls.py", line > 20, in > from apps.did.views import CountryViewSet, AreasViewSet > File "/home/ariatel_web/dashboard.ariatel.com.co/apps/did/views.py", line > 15, in > from .forms import BuySearchForm > File "/home/ariatel_web/dashboard.ariatel.com.co/apps/did/forms.py", line > 11, in > class BuySearchForm(forms.Form): > File "/home/ariatel_web/dashboard.ariatel.com.co/apps/did/forms.py", line > 12, in BuySearchForm > country = forms.ChoiceField(choices=[ (d.country_name, d.country_name) > for d in DidCountry.objects.filter(is_active=True) ], required=False) > File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", > line 258, in __iter__ > self._fetch_all() > File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", > line 1074, in _fetch_all > self._result_cache = list(self.iterator()) > File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", > line 52, in __iter__ > results = compiler.execute_sql() > File > "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py", > line 848, in execute_sql > cursor.execute(sql, params) > File "/usr/local/lib/python2.7/dist-packages/django/db/backends/utils.py", > line 79, in execute > return super(CursorDebugWrapper, self).execute(sql, params) > File "/usr/local/lib/python2.7/dist-packages/django/db/backends/utils.py", > line 64, in execute > return self.cursor.execute(sql, params) > File "/usr/local/lib/python2.7/dist-packages/django/db/utils.py", line 95, > in __exit__ > six.reraise(dj_exc_type, dj_exc_value, traceback) > File "/usr/local/lib/python2.7/dist-packages/django/db/backends/utils.py", > line 64, in execute > return self.cursor.execute(sql, params) > File > "/usr/local/lib/python2.7/dist-packages/django/db/backends/sqlite3/base.py", > line 323, in execute > return Database.Cursor.execute(self, query, params) > django.db.utils.OperationalError: no such table: did_didcountry > > > El viernes, 29 de julio de 2016, 9:44:05 (UTC-5), Jorge Cadena escribió: >> >> same error, in mariaDB, postgresql, rigth now in sqlite3 >> >> >> El viernes, 29 de julio de 2016, 9:07:33 (UTC-5), Jorge Cadena escribió: >>> >>> Hi, >>> >>> I am dev i
Re: django 1.9, migrations SUCK
Excellent, thanks This method i use from django 1.4, never have problem. 2016-07-29 11:36 GMT-05:00 ludovic coues : > In /home/ariatel_web/dashboard.ariatel.com.co/apps/did/forms.py, replacing > country = forms.ChoiceField(choices=[ (d.country_name, > d.country_name) for d in DidCountry.objects.filter(is_active=True) ] > > with > country = forms.ChoiceField(choices=lambda: [ (d.country_name, > d.country_name) for d in DidCountry.objects.filter(is_active=True) ] > > should do the trick. It will make the choices arguments a callable > which will be evaluated when the form is used for the first time, not > when the module is imported. > > 2016-07-29 17:01 GMT+02:00 Jorge Cadena : > > > > Traceback (most recent call last): > > File "manage.py", line 10, in > > execute_from_command_line(sys.argv) > > File > > > "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", > > line 353, in execute_from_command_line > > utility.execute() > > File > > > "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", > > line 345, 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 348, in run_from_argv > > self.execute(*args, **cmd_options) > > File > > "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", > > line 398, in execute > > self.check() > > 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 13, in check_url_config > > return check_resolver(resolver) > > File > "/usr/local/lib/python2.7/dist-packages/django/core/checks/urls.py", > > line 23, 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/ariatel_web/dashboard.ariatel.com.co/dashaboar_ariatel/urls.py", > line > > 20, in > > from apps.did.views import CountryViewSet, AreasViewSet > > File "/home/ariatel_web/dashboard.ariatel.com.co/apps/did/views.py", > line > > 15, in > > from .forms import BuySearchForm > > File "/home/ariatel_web/dashboard.ariatel.com.co/apps/did/forms.py", > line > > 11, in > > class BuySearchForm(forms.Form): > > File "/home/ariatel_web/dashboard.ariatel.com.co/apps/did/forms.py", > line > > 12, in BuySearchForm > > country = forms.ChoiceField(choices=[ (d.country_name, > d.country_name) > > for d in DidCountry.objects.filter(is_active=True) ], required=False) > > File > "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", > > line 258, in __iter__ > > self._fetch_all() > > File > "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", > > line 1074, in _fetch_all > > self._result_cache = list(self.iterator()) > > File > "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", > > line 52, in __iter__ > > results = compiler.execute_sql() > > File > > > "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py", > > line 848, in execute_sql > > cursor.execute(sql, params) > > File > "/usr/local/lib/python2.7/dist-packages/django/db/backends/utils.py", > > line 79, in execute > > return super(CursorDebugWrapper, self).execute(sql, params) > > File > "/usr/local/lib/python2.7/dist-packages/django/db/backends/utils.py", > > line 64, in execute > > return self.cursor.execute(sql, params) > > File "/usr/local/lib/python2.7/dist-packages/django/db/utils.py", line > 95, > > in __exit__ > > six.reraise(dj_exc_type, dj_exc_value, traceback) > > File > "/usr/local/lib/python2.7/dist-packages/django/db/backends/utils.py", > > line 64, in execute > > return self.cursor.execute(sql, params) > > File > > > "/usr/local/lib/python2.7/dist-packages/django/db/backends/sqlite3/base.py", > > line 323, in execute > >
DjangoWeekly Issue 3 is out
Hey Fellow Django Developers, Want to share a new Django weekly newsletter. Latest issue being 3rd http://djangoweekly.com/newsletter/no/3/ Have a look. Thanks, Ankur -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/fd91a091-2243-4931-a3f5-17df64f43d0d%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.