Hi, Yes, it connects to the same database. I only have one accessible database in the production environment and the administration interface works fine for the other models I have, it crashes only when I try to access that specific model or when trying to access the website.
Red. On 23/10/2019 05:57, wd wrote: > hi, > > You may need to check that the database django connect to is the same > as you checked that the column is exists? > > On Tue, Oct 22, 2019 at 8:32 PM red <googlec...@riseup.net > <mailto:googlec...@riseup.net>> wrote: > > Hi everyone, > > > I have a website in production. I have an app, with a model. It > contained a markdown_file attribute: > > |markdown_file=models.FileField(upload_to='/media/')| > > But since the number of file is limited, I decided to make it a > markdown_filename attribute with a choices selection box: > > > |markdown_filename=models.CharField(max_length=30,null=True,blank=True,choices=MENU_MARKDOWN_FILE_CHOICES)| > > Therefore, I modified this model and made migrations locally. I > pushed the code in production and run: > > |python manage.py migrate| > > After I checked with showmigrations and sqlmigrate, that the > modification I made were there. Then, I checked in the database, > that the fields were correctly modified. But, I still get this > error, when trying to access the website: > > |ERROR:django.request:InternalServerError:/Traceback(most recent > call > > last):File"/srv/data/web/vhosts/default/local/lib/python3.7/site-packages/django/db/backends/utils.py",line > 84,in_execute > > returnself.cursor.execute(sql,params)psycopg2.errors.UndefinedColumn:column > showcase_subpage.markdown_file does notexist LINE > 1:...bpage"."slug", "showcase_subpage"."html_content", > "showcase_...^Theabove exception was the direct cause of the > following exception:Traceback(most recent call > > last):File"/srv/data/web/vhosts/default/local/lib/python3.7/site-packages/django/core/handlers/exception.py",line > 34,ininner response > > =get_response(request)File"/srv/data/web/vhosts/default/local/lib/python3.7/site-packages/django/core/handlers/base.py",line > 115,in_get_response response > > =self.process_exception_by_middleware(e,request)File"/srv/data/web/vhosts/default/local/lib/python3.7/site-packages/django/core/handlers/base.py",line > 113,in_get_response response > > =wrapped_callback(request,*callback_args,**callback_kwargs)File"./showcase/views.py",line > 10,inhome > > returnrender(request,'showcase/home.html',context)File"/srv/data/web/vhosts/default/local/lib/python3.7/site-packages/django/shortcuts.py",line > 36,inrender content > > =loader.render_to_string(template_name,context,request,using=using)File"/srv/data/web/vhosts/default/local/lib/python3.7/site-packages/django/template/loader.py",line > 62,inrender_to_string > > returntemplate.render(context,request)File"/srv/data/web/vhosts/default/local/lib/python3.7/site-packages/django/template/backends/django.py",line > 61,inrender > > returnself.template.render(context)File"/srv/data/web/vhosts/default/local/lib/python3.7/site-packages/django/template/base.py",line > 171,inrender > > returnself._render(context)File"/srv/data/web/vhosts/default/local/lib/python3.7/site-packages/django/template/base.py",line > 163,in_render > > returnself.nodelist.render(context)File"/srv/data/web/vhosts/default/local/lib/python3.7/site-packages/django/template/base.py",line > 937,inrender bit > > =node.render_annotated(context)File"/srv/data/web/vhosts/default/local/lib/python3.7/site-packages/django/template/base.py",line > 904,inrender_annotated > > returnself.render(context)File"/srv/data/web/vhosts/default/local/lib/python3.7/site-packages/django/template/loader_tags.py",line > 150,inrender > > returncompiled_parent._render(context)File"/srv/data/web/vhosts/default/local/lib/python3.7/site-packages/django/template/base.py",line > 163,in_render > > returnself.nodelist.render(context)File"/srv/data/web/vhosts/default/local/lib/python3.7/site-packages/django/template/base.py",line > 937,inrender bit > > =node.render_annotated(context)File"/srv/data/web/vhosts/default/local/lib/python3.7/site-packages/django/template/base.py",line > 904,inrender_annotated > > returnself.render(context)File"/srv/data/web/vhosts/default/local/lib/python3.7/site-packages/django/template/defaulttags.py",line > 166,inrender len_values > > =len(values)File"/srv/data/web/vhosts/default/local/lib/python3.7/site-packages/django/db/models/query.py",line > 256,in__len__ > > self._fetch_all()File"/srv/data/web/vhosts/default/local/lib/python3.7/site-packages/django/db/models/query.py",line > 1242,in_fetch_all self._result_cache > > =list(self._iterable_class(self))File"/srv/data/web/vhosts/default/local/lib/python3.7/site-packages/django/db/models/query.py",line > 55,in__iter__ results > > =compiler.execute_sql(chunked_fetch=self.chunked_fetch,chunk_size=self.chunk_size)File"/srv/data/web/vhosts/default/local/lib/python3.7/site-packages/django/db/models/sql/compiler.py",line > 1100,inexecute_sql > > cursor.execute(sql,params)File"/srv/data/web/vhosts/default/local/lib/python3.7/site-packages/django/db/backends/utils.py",line > 67,inexecute > > returnself._execute_with_wrappers(sql,params,many=False,executor=self._execute)File"/srv/data/web/vhosts/default/local/lib/python3.7/site-packages/django/db/backends/utils.py",line > 76,in_execute_with_wrappers > > returnexecutor(sql,params,many,context)File"/srv/data/web/vhosts/default/local/lib/python3.7/site-packages/django/db/backends/utils.py",line > 84,in_execute > > returnself.cursor.execute(sql,params)File"/srv/data/web/vhosts/default/local/lib/python3.7/site-packages/django/db/utils.py",line > 89,in__exit__ > raisedj_exc_value.with_traceback(traceback)fromexc_value > > File"/srv/data/web/vhosts/default/local/lib/python3.7/site-packages/django/db/backends/utils.py",line > 84,in_execute > > returnself.cursor.execute(sql,params)django.db.utils.ProgrammingError:column > showcase_subpage.markdown_file does notexist LINE > 1:...bpage"."slug", "showcase_subpage"."html_content", "showcase_...^| > > The markdown_file field has been modified and renamed as > markdown_filename. It has been correctly specified in the > migrations. The modification is effective in the database. I > tested locally (it works fine locally), to make sure, I don’t have > anymore code calling markdown_file attribute. I also tried > clearing the migrations history and the database, to rebuilt it as > new, but, the problem is still there. I can’t see why, this former > attributes is still queried, though the migrations went OK, > without any error. > > -- > 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 > <mailto:django-users+unsubscr...@googlegroups.com>. > To view this discussion on the web visit > > https://groups.google.com/d/msgid/django-users/4ff82558-df2a-85a7-e10c-fd567c768862%40riseup.net > > <https://groups.google.com/d/msgid/django-users/4ff82558-df2a-85a7-e10c-fd567c768862%40riseup.net?utm_medium=email&utm_source=footer>. > > -- > 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 > <mailto:django-users+unsubscr...@googlegroups.com>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/CABexzmg2T%2B7QQynYsykOAY1NKr6gSEcNv%3DBW9Uc-NUqreZFs8Q%40mail.gmail.com > <https://groups.google.com/d/msgid/django-users/CABexzmg2T%2B7QQynYsykOAY1NKr6gSEcNv%3DBW9Uc-NUqreZFs8Q%40mail.gmail.com?utm_medium=email&utm_source=footer>. -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/f2debe43-4f5e-6b4e-3971-8f8fe97d4dc7%40riseup.net.