How to set static file in django with templateview

Sometimes I got confused whether to set my static file with nginx or just inside the Django. This is how I do it inside urls.py in django app directory. from django.views.generic import TemplateView urlpatterns = { …. url(r’^static\.txt$’, TemplateView.as_view(template_name=’files/static.txt’, content_type=’text/plain’)), …. } and navigate to https://myurl.com/static.txt

Django table is marked as crashed and should be repaired

My django app is showing 500 because one of the tables in database marked crashed and should be repaired. InternalError at / (145, “Table ‘./dbname/django_session’ is marked as crashed and should be repaired”) I thought it was just an usual error from mysql and needed to restart but it wasn’t. Solutions:  Login to mysql, select your … Read more