Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
rest framework 'user_code' is an invalid keyword argument for this function Request Method: POST Request
I`m trying to create a new BCodes on save BDetail in the same endpoint but when i test, throw framework 'user_code' is an invalid keyword argument for this function Request Method: POST Request. BCodes model class BCodes(models.Model): user_code = models.IntegerField() building_code = models.CharField(max_length=10) oldkey = models.CharField(max_length=32, blank=True, null=True) date_added = models.IntegerField(blank=True, null=True) is_bm = models.IntegerField(blank=True, null=True) bm_src = models.IntegerField(blank=True, null=True) agents = models.ForeignKey(Agents, models.DO_NOTHING, blank=True, null=True) clients = models.ForeignKey('Clients', models.DO_NOTHING, blank=True, null=True) free_property = models.ForeignKey('FreePublishers', models.DO_NOTHING) approve_free_bm = models.IntegerField() class Meta: managed = False db_table = 'b_codes' unique_together = (('user_code', 'building_code'),) BDetail model class BDetail(models.Model): kind_building = models.ForeignKey('Typebuilding', models.DO_NOTHING, db_column='kind_building') kind_offer = models.ForeignKey('Typeoffer', models.DO_NOTHING, db_column='kind_offer') country = models.ForeignKey('Countries', models.DO_NOTHING, db_column='country') city = models.ForeignKey('Cities', models.DO_NOTHING, db_column='city') sector = models.ForeignKey('Sectors', models.DO_NOTHING, db_column='sector') zone = models.ForeignKey('ZonesStandard', models.DO_NOTHING, db_column='zone') address = models.CharField(max_length=100, blank=True, null=True) show_address = models.IntegerField() show_stview = models.IntegerField(blank=True, null=True) lat = models.FloatField(blank=True, null=True) lng = models.FloatField(blank=True, null=True) area_m = models.FloatField(blank=True, null=True) area_um = models.ForeignKey(AreaMetters, models.DO_NOTHING, db_column='area_um', blank=True, null=True) area_built = models.FloatField(blank=True, null=True) area_private = models.FloatField(blank=True, null=True) area_m_front = models.FloatField(blank=True, null=True) area_um_front = models.ForeignKey(AreaMetters, models.DO_NOTHING, db_column='area_um_front', blank=True, null=True) area_m_back = models.FloatField(blank=True, null=True) area_um_back = models.ForeignKey(AreaMetters, models.DO_NOTHING, db_column='area_um_back', blank=True, null=True) area_proximity = models.IntegerField(blank=True, null=True) remade = models.IntegerField(blank=True, null=True) remade_m = models.IntegerField(blank=True, null=True) remade_y = … -
Creating a django manager with a parameter
I have the following situation I have a manager class that filters a queryset according to a field. The problem is that the field name is different according to the class but the value to which it filters comes from the same place (so i thought i don't need several managers). This is what i did so far. class MyManager(models.Manager): def __init__(self, field_name): super(MyManager, self).__init__() self.field_name = field_name def get_queryset(self): # getting some value kwargs = { self.field_name: some_value } return super(MyManager, self).get_queryset().filter(**kwargs) class A: # some datamembers @property def children(self): return MyUtils.prepare(self.b_set.all()) class B: objects = MyManager(field_name='my_field_name') a = models.ForeignKey(A, null=False, blank=False) When i run tests i that retrieve from the DB a B object, and try to read the children property i get the following error: self = <django.db.models.fields.related_descriptors.RelatedManager object at 0x7f384d199290>, instance = <A: A object> def __init__(self, instance): > super(RelatedManager, self).__init__() E TypeError: __init__() takes exactly 2 arguments (1 given) I know its because of the constructor parameter because when i remove it (or give it a default value) all of the tests work. How can i overcome this? Is this the right way of achieving this? Tech stuff: Django 1.9.5 test framework py.test 2.9.1 Thanks -
Getting import error even after installing the modules
I am tryng to setup a django project on my system and it is giving me this error. $ python manage.py runserver 8001 Unhandled exception in thread started by <function check_errors. <locals>.wrapper at 0x7fce88b74400> Traceback (most recent call last): File "venv/lib/python3.5/site-packages/django/utils/autoreload.py", line 229, in wrapper fn(*args, **kwargs) File "venv/lib/python3.5/site-packages/django/core/management/commands/runserver.py", line 107, in inner_run autoreload.raise_last_exception() File "venv/lib/python3.5/site-packages/django/utils/autoreload.py", line 252, in raise_last_exception six.reraise(*_exception) File "venv/lib/python3.5/site-packages/django/utils/six.py", line 685, in reraise raise value.with_traceback(tb) File "venv/lib/python3.5/site-packages/django/utils/autoreload.py", line 229, in wrapper fn(*args, **kwargs) File "venv/lib/python3.5/site-packages/django/__init__.py", line 18, in setup apps.populate(settings.INSTALLED_APPS) File "venv/lib/python3.5/site-packages/django/apps/registry.py", line 85, in populate app_config = AppConfig.create(entry) File "venv/lib/python3.5/site-packages/django/apps/config.py", line 86, in create module = import_module(entry) File "venv/lib/python3.5/importlib/__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 986, in _gcd_import File "<frozen importlib._bootstrap>", line 969, in _find_and_load File "<frozen importlib._bootstrap>", line 956, in _find_and_load_unlocked ImportError: No module named 'debugtools' First i thought it is requiring django-debug-toolbar package. But even after installing it it is giving me the same error. I am using django 1.8 with python3.5 -
How to add html before a specific form in Django + Grappelli?
I'm using Django + Grappelli and trying to add some custom html to my form. Can u guys give me a light? -
How to implement realtime search in materialize framework select dropdowns?
Here is the script from materialize.css $(document).ready(function() { $('select').material_select(); }); that transforms my select widgets to this: <div class="select-wrapper"> <span class="caret">▼</span> <input type="text" class="select-dropdown" readonly="true" data-activates="select-options-348f9dd5-8861-8ae6-4f3c-c283869375b6" value="---------"> <ul id="select-options-348f9dd5-8861-8ae6-4f3c-c283869375b6" class="dropdown-content select-dropdown" style="width: 461.594px; position: absolute; top: 0px; left: 0px; opacity: 1; display: none;"> <li class=""><span>---------</span></li> <li><input class="validate" id="id_search_undefined" name="phone" type="text" required=""></li> <li class=""><span>Chevrolet XTRAIL</span></li> </ul> <select id="id_series" name="series" required="" class="initialized"> <option value="" selected="selected">---------</option> <option value="1">Chevrolet XTRAIL</option> </select></div> I need some autocomplete option for this one. I tried to add this line to $(document).ready() section: $('.select-dropdown li:nth-child(1)').after('<li><input class="validate easy_select" id="id_search_' + $(this).next().attr('id') + '" name="phone" type="text" required=""></li>'); but on mouse down on li that contains search input involved disappearing of options list. How to realize nice autocomplete option for this block? -
How to get all related fiedls in a multi foreign and manytomany relationship in Django?
Given the models below and their contents how do you get all A's whose B is '8' and whose C is '10'? Getting the A's whose B is '8' is easy using but C's manytomany relationship with A makes it harder doing directly. A = ['1','2','3','4','5, 6','7'] // where '1','2','3','4' has B = '8' and C = '10' B = ['8','9'] C = ['10','11'] class A(models.Model): name = models.CharField(max_length=32) b = models.ForeignKey('B',) cs = models.ManyToManyField('C',blank=True) class B(models.Model): name = models.CharField(max_length=15) class C(models.Model): name = models.CharField(max_length=32) -
Extract the User Selected Text from the Embedded pdf
I am developing a webapp in Python Django for annotation in books.I embed the book pdf using object tag in HTML.To annotate it, the user selects a sentence from the pdf. I need to get the user selected text to store it with annotated tags. Is it possible to get the selected text from the embed pdf. -
Puppet Dependency file failing in local Vagrant Environmnet
Below is my Puppet code for a Python Django App. class ltp ($project_dir = '/vagrant') { exec { "install_project_dependencies": cwd => $project_dir, command => "/usr/bin/python setup.py install > /tmp/setuplog 2>&1", timeout => 0, } exec { "install_nltk_data": cwd => $project_dir, command => "su - vagrant -c \"cd /opt/vagrant; /usr/bin/python -m nltk.downloader stopwords > /tmp/nltklog 2>&1\"", require => Exec['install_project_dependencies'] } exec { "install_django_db": cwd => $project_dir, user => 'vagrant', environment => ["ENV=DEV"], command => "/usr/bin/python manage.py syncdb --noinput > /tmp/syncdblog 2>&1", require => Exec['create_ba_database'] } exec { "create_ba_database": cwd => $project_dir, command => "echo \"psql -c 'create database burson_clips;'\" | sudo su postgres", require => Exec['change_pg_password'] } exec { "change_pg_password": cwd => $project_dir, command => "sudo -u postgres psql -c \"alter user postgres with password 'postgres';\"" } } Below is the error Vagrant gives when I run vagrant provision clips: Error: /usr/bin/python setup.py install > /tmp/setuplog 2>&1 returned 1 instead of one of [0] ==> clips: Error: /Stage[main]/Ltp/Exec[install_project_dependencies]/returns: change from notrun to 0 failed: /usr/bin/python setup.py install > /tmp/setuplog 2>&1 returned 1 instead of one of [0] ==> clips: Warning: /Stage[main]/Ltp/Exec[install_nltk_data]: Skipping because of failed dependencies ==> clips: Notice: /Stage[main]/Ltp/Exec[change_pg_password]/returns: executed successfully ==> clips: Notice: /Stage[main]/Ltp/Exec[create_ba_database]/returns: ERROR: database "burson_clips" already exists … -
Filter by empty value inside column Django object
How do I filter by just empty value? I can do this: Name.objects.filter(alias__isnull=False) But it will not work because it's just empty inside the column with no value. How can I filter by that? -
In linkedin how we get all connected users or followers python
In linkedin when i fetch all connection using get_connections, Only its giving 500 connection but in my linkedin account connected users is 2931 so how can i get all users count or followers any ideas ? -
Highcharts in Django using ajax
I am new to Django. I am making polls application and want to use highcharts to display graphs. I have a template which displays all the polls. I want to show the corresponding results of poll beside it in form of chart. Part of the template: {% for question in poll_questions %} <div class="col-sm-6"> <div class="panel panel-default"> <div class="panel-body"> <div class="row"> <div class="col-sm-12"> {{question.question_text}} {% for choice in question.poll_choices_set.all %} <div> <label><input type="radio" name="{{question.pk}}" value="{{ choice.pk }}">&nbsp {{choice.choice_text}}</label> </div> {% endfor %} </div> </div> </div> </div> </div> <div class="col-sm-6"> <div id="{{ question.pk }}" class="chart" style="height: 400px; width: 400px"></div><br> <script> var question_id = '{{ question.pk }}' </script> <script src="{% static 'er_interface/polls.js' %}"></script> </div> {% endfor %} Javascript file- polls.js: $.getJSON('/er/poll/'+question_id ,function(data) { $('#'+question_id).highcharts({ chart: { type: 'pie' }, title: { text: question_id }, tooltip: { pointFormat: ':<b>{point.y}</b>' }, plotOptions: { pie: { allowPointSelect: true, cursor: 'pointer', dataLabels: { enabled: false }, showInLegend: true }, series: { dataLabels: { enabled: true, formatter: function() { return Math.round(this.percentage*100)/100 + ' %'; }, distance: 0, } } }, series: data }); }); The problem is that graph is shown just for the last poll question. Thanks -
Rendering a Django block when clicking a sidebar button
I'm trying to create a management website with Django. I've got the basic functionality working, but I have trouble rendering content "dynamically". I want to render a block based on clicking a button. Currently, I have an employee view that renders certain event-objects as a tree. I'm using Django's mptt library for building the tree. employeeView @method_decorator(login_required, name='dispatch') class employeeView(View): def get(self, request, user_id): if request.user.is_authenticated(): user=request.user nodes = Event.objects.filter(owner=user) return render(request, "employee_view.html", {'user': user, 'nodes': nodes}) employee_template.html {% extends "base.html" %} {% block content %} <title>Your events</title> These are your events {% load mptt_tags %} <ul> {% recursetree nodes %} <li> <b>{{ node.name }} </b> {% if not node.is_leaf_node %} <ul class="children"> {{ children }} </ul> {% endif %} </li> {% endrecursetree %} </ul> {% endblock %} Then I have a manager view, that currently returns the employees who are managed by the manager, and all events associated to them. managerView class managerView(View): @method_decorator(user_passes_test(lambda i: u.myuser.isManager)) def get(self, request, user=None, myuser=None): if request.user.is_authenticated(): user = request.user ... return render(request, "supervisor_view.html", {'user': user, 'employees': employees, "nodes": nodes,}) Everything works as intended so far. The managed employees are given to the manager template, and rendered on a sidebar. Below is a … -
Django-registration issues with namespaces
I am using django-registration 2.12 and django 1.10. I am trying to use django-registration. If I include app_name in my urls.py I get the error Reverse for 'auth_password_reset' with arguments '()' and keyword arguments '{}' not found. for the login url. My urls.py for the app is from django.conf.urls import include, url from . import views app_name = 'my_app' urlpatterns = [ url(r'^$', views.index_view, name='index'), url(r'^about$', views.about_view, name='about'), url(r'^data$', views.data_view, name='data'), url(r'^accounts/', include('registration.backends.hmac.urls')), ] -
Combine two different models in Django Rest Framework
I have two unrelated models: class ModelOne(models.Model): fieldA = models.CharField(max_length=50) fieldB = models.CharField(max_length=50) class ModelTwo(models.Model): fieldC = models.CharField(max_length=50) fieldD = models.CharField(max_length=50) I want to build one serilaizer with DRF so that I can have a returned json like this one: },... { 'fieldA' : 'a', 'fieldB' : 'b', 'fieldC' : 'c', 'fieldD' : 'd' }, ... I'm unable to do it right now. I've tried this module but I run into an error. -
Django website getting logout
We have a website www.recruiter.com , this website is live for end user from past 10 years. Now from past 3 month (rough figure) we are getting call from users that while using website users getting logged out. count of this type of user is very high. we are storing sessions in memcache some dependency djangorestframework==3.0.4 django-redis==3.8.3 django-mongodb-cache==0.1.0 memcache-toolbar==0.5.6 python-memcached==1.53 Django==1.6.5 Settings MIDDLEWARE_CLASSES = ( 'corsheaders.middleware.CorsMiddleware', 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'recruiter.middleware.SessionExpiryMiddleware', 'recruiter.middleware.MultiLoginMiddleware', 'middleware.profile_middleware.ProfileMiddleware', 'middleware.sumoplus_middleware.SumoPlusMiddleware' ) AUTHENTICATION_BACKENDS = ( 'recruiter.backends.RecruiterBackend', 'django.contrib.auth.backends.ModelBackend', ) SESSION_ENGINE = 'django.contrib.sessions.backends.cache' -
KeyError when trying to enforce uniqueness of imported data
I have a model on which data imported from an excel files are saved. I want to prevent having duplicate entries,it will check the already existing data to see if they match with the ones . My model from django.db import models class UserData(models.Model): GENDER_CHOICES = ( ('Male', 'Male'), ('Female', 'Female'), ) first_name = models.CharField(max_length=50) last_name = models.CharField(max_length=50) age = models.IntegerField() gender = models.CharField(default='Male', choices=GENDER_CHOICES, max_length=6) address = models.CharField(max_length=200) class Meta: verbose_name_plural = 'User Data' def __str__(self): return self.fullname() views.py class UploadFileForm(forms.Form): file = forms.FileField() def import_data(request): if request.method == "POST": form = UploadFileForm(request.POST, request.FILES) if form.is_valid(): request.FILES['file'].save_to_database( name_columns_by_row=2, model=UserData, mapdict=['first_name', 'last_name', 'age', 'gender', 'address']) return HttpResponse("OK") else: return HttpResponseBadRequest() else: form = UploadFileForm() return render_to_response('excel/upload_form.html', {'form': form}, context_instance=RequestContext(request)) I tried using unique_together and also tried overriding cleaned_data in the form but still can't prevent duplicates being added to the db. What will be the best way to achieve this? Thanks -
Django UpdateView for dealing with two forms occur errors
I'm trying to make django views for dealing with two forms. This kind of view is used for 'signup' and 'login' are in same template(For instance, modal structure, e.g http://bootsnipp.com/snippets/featured/login-amp-signup-forms-in-panel) And I got an idea of dealing with two forms from here (https://chriskief.com/2012/12/30/django-class-based-views-with-multiple-forms/) I have one model for user: from django.contrib.auth.models import AbstractUser from django.db import models GENDER_CHOICES = ( ('M', '남'), ('F', '여'), ) class ChachaUser(AbstractUser): birth = models.DateField() gender = models.CharField(max_length=1, choices=GENDER_CHOICES) REQUIRED_FIELDS = ['email', 'birth', 'gender', ] And form : from django import forms from django.contrib.auth.forms import UserCreationForm from django.contrib.auth import get_user_model GENDER_CHOICES = ( ('M', '남'), ('F', '여'), ) class MyUserCreationForm(UserCreationForm): birth = forms.DateField( widget=forms.SelectDateWidget( years=range(1970, 2015) ), required=True, ) gender = forms.ChoiceField(choices=GENDER_CHOICES, initial='M') class Meta(UserCreationForm.Meta): model = get_user_model() fields = UserCreationForm.Meta.fields + ('birth', 'gender') I start to implement view for GET request with this model and form: from django.contrib.auth.forms import AuthenticationForm from django.views.generic import UpdateView from django.shortcuts import get_object_or_404 from django.core.urlresolvers import reverse_lazy from users.forms import MyUserCreationForm from users.models import ChachaUser class LoginSignupView(UpdateView): template_name = 'users/login.html' form_class = AuthenticationForm second_form_class = MyUserCreationForm success_url = '/' def get_context_data(self, **kwargs): context = super(LoginSignupView, self).get_context_data(**kwargs) if 'form' not in context: context['form'] = self.form_class() if 'form2' not in context: … -
How to list all the menu of a specific restaurant in a category basis
I am using django rest framework for rest API. I could create an api for restaurant list and detail , menu list and detail and also listed down all the menus of a specific restaurant but in a messy way. my model for restaurant and menu is class Restaurant(models.Model): owner = models.ForeignKey(User) name = models.CharField(max_length=150, db_index=True) slug = models.SlugField(max_length=150, db_index=True) address = models.CharField(max_length=100) class MenuCategory(models.Model): name = models.CharField(max_length=120,db_index=True) #veg, non-veg slug = models.SlugField(max_length=120,db_index=True) class Menu(models.Model): menu_category = models.ForeignKey(MenuCategory, related_name="menu") restaurant = models.ForeignKey(Restaurant) name = models.CharField(max_length=120,db_index=True) slug = models.SlugField(max_length=120,db_index=True) serializers.py class RestaurantDetailSerializer(ModelSerializer): owner = SerializerMethodField() features = FeaturehoiceSerializer(many=True) timings = TimingChoiceSerializer(many=True) review = SerializerMethodField() menu = SerializerMethodField() class Meta: model = Restaurant read_only = ('id',) def get_owner(self, obj): return str(obj.owner) def get_review(self, obj): review_qs = Review.objects.filter_by_instance(obj) review = ReviewSeraializer(review_qs, many=True).data return review def get_menu(self, obj): restaurant = Restaurant.objects.get(slug=str(obj.slug)) menu_qs = restaurant.menu_set.filter(available=True) menu = MenuSerializer(menu_qs, many=True).data return menu class MenuCategorySerializer(ModelSerializer): # menu = SerializerMethodField() class Meta: model = MenuCategory class MenuSerializer(ModelSerializer): menu_category = MenuCategorySerializer(read_only=True, many=False) class Meta: model = Menu read_only = ('id',) urls.py url(r'^(?P[\w-]+)/$', RestaurantDetailAPIView.as_view(), name="restaurantdetailapiview"), "menu": [ { "id": 2, "menu_category": { "id": 2, "name": "Non-veg", "slug": "non-veg" }, "name": "Ham Cheesy Burger", "slug": "ham-cheesy-burger", "image": "/media/products/2016/08/25/ham_burger.jpg", "description": "Double cheese … -
Illustration/visualisation of django web framework structure
It would be helpful if there were a "high level" (boxes and arrows) drawing illustrating the structure of the Django web framework. This would show the interaction between views,URLconf,models,templates etc and HTTP calls. Does such a thing exist? What high level illustrations, showing the structure of the django web framework, exist? -
Change GET parameter in URL in django
I make a searchable ListView. I pass parameters in request.GET dictionnary. The problem is when I'm on page 21, if I change parameters of the query, I have a new queryset which may have less than 21 pages. The default behavior is too raise a 404. I override the method paginate_queryset to check if it's the case and if so I set the page_number to 1. The problem is that when I'm on my browser go to http://127.0.0.1:8000/utilisateur/liste?page=21&Utilisateur-appareil=# it works as expected but if I change Utilisateur-appareil value in the form and I submit. I'm on the page : http://127.0.0.1:8000/utilisateur/liste?page=21&Utilisateur-appareil=13# I'm now on the page 1 of my view because there is not 21 pages create by the paginator. But the Uri stay with the parameter page=21 I'd like to override this behavior. I've already check if I modify the request.GET dictionnary (bad thing) that doesn't change the URI response. -
Django form customise FileField
I'm doing a super simple image upload for my django application and I'm stuck on customising the label that permit the upload. Right now, it looks like: Which is pretty ugly and has nothing to do with what I did in my code. I would like to customise the button style and have the text "no file chosen" on the top of it (or under, whatever). The code: class ImageForm(forms.Form): imageFile = forms.FileField( label = _('select an image') ) and my model: class ImageVisionModel(CMSPlugin): def __str__(self): return 'Computer vision demo' Because I'm not storing the image. So I don't know if I'm missing something, but when I inspect the element, label + text are only one and single element. And except the text on the right of the label, it seems that I can't modify anything on the button directly. I looked on StackOverflow and the django doc but I found nothing. Or maybe am I missing something? -
How to render Form instance in Django CreateView & UpdateView?
I'm trying to refactor my code into class-based views, and I'm having trouble understanding how to return/render at the end. I'm trying to render the form with the supplied POST data on success (or fail), with an appropriate confirmation message, so that it can be updated. Here's some example code, with comments showing what I want to return (where I don't know how): from django.views.generic import CreateView, UpdateView from my_app.forms import ProductCreateForm from my_app.models import Product from django.contrib.auth.models import User class ProductCreate(CreateView): """Simple CreateView to create a Product with ForeignKey relation to User""" model = Product form_class = ProductCreateForm template = 'product_create.html' def form_valid(self, form): user = User.objects.filter(username=form.cleaned_data['user_email']).first() if user is None: messages.error("Invalid user email specified") return some http response here... #How to I render the page again, but with the data already in the #form we don't have to re-enter it all? form.save() messages.info("Successfully saved the product!") return some http response here... #How do I redirect to the UpdateView here with the Product instance #already in the form? class ProductUpdate(UpdateView): model = Product form_class = ProductCreateForm template = 'product_create.html' -
Using Pycharm debug django meet error
I tried to debug my django project using pycharm, but failed with errors about connecting to mysql database with "Error loading MySQLdb module". I actually have meet this problem when I was connecting django with mysql at first and solved it by adding a line of "export DYLD_LIBRARY_PATH=/usr/local/mysql/lib/" in bash_profile because in my Mac mysql is stalled in this path. I tried add this variable to Pycharm preference's Python console and Django console but it still doesn't work. I think this might because Pycharm has a built in environment variable settings but how can I fix this problem? Thanks for helping! Btw I'm using Macbook, Python3.5, Django1.10, MySQL. -
How to properly set up dockerized django app with SSL handling using self-signed certificate and mod_wsgi-express?
I am using grahamdumpleton/mod-wsgi-docker:python-3.4-onbuild docker image and I run the django app inside with the command: --allow-localhost --server-name 0.0.0.0 --startup-log --log-to-terminal --working-directory . --https-only --ssl-certificate-file /app/keys/server.crt --ssl-certificate-key-file /app/keys/server.key --https-port 8443 --application-type module datapie.wsgi`. I bind the port 8007 on my local machine to port 8443 of the container. I created self-signed certificate with FQDN set to *. The problem is I get the 403 response when trying to access the server on https://localhost:8007. When trying to connect from inside the container everything works fine. Any advice on how to set this up properly? -
Django staticfiles with cache busting
I'm trying to migrate my project from using {% compress %} to grunt for the whole front-end workflow. I got my grunt setup correctly and I can generate my main.min.css and main.min.js. With collectstatic I see them copied to the right folder, but when I deploy to staging all I get is a big fat 500 error. INSTALLED_APPS = ( 'django.contrib.contenttypes', 'django.contrib.messages', 'django.contrib.staticfiles', 'captcha', 'core', ) STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.ManifestStaticFilesStorage' STATICFILES_FINDERS = ( "django.contrib.staticfiles.finders.FileSystemFinder", "django.contrib.staticfiles.finders.AppDirectoriesFinder", "compressor.finders.CompressorFinder", ) and in the template: <link rel="stylesheet" href="{% static "core/dist/css/main.min.css" %}" /> It works locally if I set DEBUG=False in settings.py (without loading the static files obviously). Any idea?