Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
pyexcel export error "No content, file name. Nothing is given"
I'm using django-pyexcel to export data from the website, but when I go to the export URL I get the error: Exception Type: IOError Exception Value: No content, file name. Nothing is given The code to export the data was copied from the example given in the documentation: return excel.make_response_from_a_table(Question, 'xls', file_name="sheet") -
How to make a function act like a field in the Django Admin?
I have a model with an IntegerField based upon a list of items. LIST = ( (0, 'None'), (1, 'Male'), (2, 'Female'), ) class MyModel(models.Model): gender = models.IntegerField(choices=LIST, default=0) some_unimportant_value1 ... some_unimportant_value2 ... There is also a function in the MyModel class which returns False if gender has not yet been assigned a value. def genderHasValue(self): if self.gender == 0: return False When viewing the list of MyModels in the Django Admin area, I'd like to be able to see the computed result of the genderHasValue function. For example, the Django Admin area for MyModel might look like this: some_unimportant_value1 some_unimportant_value2 genderHasValue 123 456 N 789 012 Y This assumes the some_unimportant_value1 row has 0 as its IntegerField, and the some_unimportant_value2 row has 1 as its IntegerField. Can the genderHasValue function be made do this? Thank you. -
Create a new derived object from an existing base object (not derived)
Assuming the following class structure in django: class Base() class Derived(Base) And this base object (which is just Base, not Derived) b = Base() b.save() I'd like to create a derived object from b. Which would be the right way to do this? I've tried: d = Derived(b) d = Derived(base_ptr=b) Thanks NOTE: I think this is a different question than "How to go from a Model base to derived class in Django?" as what I need is to create a new derived object from an existing base (and only base) object. In that question it checks if the derived class already exists and then returns it. In my case, derived object does not exist. -
how to access django related field from model methods?
is it possible to access django related field from model methods? for example, i have an Author with many Books is it possible to access the list of books from a Model Method in Book model. class Author(models.Model) name=charfield def mymodelmethod(self):: self.book_set????; class Book: author = foreignkey(book) title = charfield -
How to use allauth confirmation email with custom registration?
I have custom registration form with my own registration view. I've started to using django-allauth recently and I would like to add email confirmation to my registration. Is it possible? registration view: def registration(request): user_creation_form = UserProfileCreationForm(request.POST or None) if request.method == 'POST': if user_creation_form.is_valid(): user_creation_form.save() username = user_creation_form.cleaned_data['username'] password = user_creation_form.cleaned_data['password2'] user = authenticate(username=username, password=password) login(request, user) messages.add_message(request, messages.SUCCESS, YOU_HAVE_BEEN_REGISTERED) return HttpResponseRedirect(reverse('homepage')) return render(request, 'dolava/accounts/registration.html', context={'user_creation_form': user_creation_form}) This is how rewrite allauth templates: in SETTINGS.PY TEMPLATE_LOADERS = ( 'django.template.loaders.filesystem.Loader', 'django.template.loaders.app_directories.Loader', ) TEMPLATE_DIRS = (os.path.join(BASE_DIR, 'templates','allauth'),) main app templates: templates/account/password_reset.html (overriden allauth templates) The problem is that I want to have many fields in registration template like type_of_user, telephone etc. registration.html: {% extends 'base.html' %} {% load static %} {% block head %} <script src="{% static "js/registrationToggleFields.js" %}"></script> <link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/css/select2.min.css" rel="stylesheet"/> <script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/js/select2.min.js"></script> <script type="text/javascript"> $(document).ready(function () { $('#id_country').select2(); $('#id_telephone_0').select2(); }); </script> {% endblock %} {% block content %} <div class="col-md-12 text-center"> <h2>Register your account</h2> <hr class="col-md-12 blackhr no-bottom-margin"> </div> {# <div class="col-md-12 text-center center-block">#} <form action="" method="post" class="col-md-6 col-md-offset-3" id="register-form"> {% csrf_token %} {{ user_creation_form.non_field_errors }} <div id="form-account-type"> <h3 align="center" class="main-color">Account Type</h3> <hr> {# <div class="col-md-12">#} <div id="type-of-user-field-wrapper" class="fieldWrapper"> <div> <label for="{{ user_creation_form.type_of_user.id_for_label }}">Type of user:</label> {% if user_creation_form.type_of_user.field.required … -
Django - Get centroid of polygon in geoJSON format
I'm building a REST API to manage geo data. My front-end developer wants to retrieve centroid of polygons, depending on zoom level, in geoJSON. My polygon model is as follow: ... from django.contrib.gis.db import models as geomodels class Polygon(geomodels.Model): fk_owner = models.ForeignKey(User, on_delete=models.DO_NOTHING, blank=True) external_id = models.CharField(max_length=25, unique=True) func_type = models.CharField(max_length=15) coordinates = geomodels.PolygonField(srid=3857) properties = JSONField(default={}) The API currently returns things like this: "type": "FeatureCollection", "features": [ { "type": "Feature", "geometry": { "type": "Polygon", "coordinates": [[[..]]] } }] And I use rest_framework_gis.serializers.GeoFeatureModelSerializer to serialize my data. I see several way to get centroid: Add a column centroid to my model: I don't want to do this Create a database view of my model: Django does not manage database views and I don't want to write a custom migration Use the same model and add an extra(...) to my orm statement: I tried but things get hard in or before serialization, because in the model the type is Polygon, and the centroid is a Point. The error is the following: TypeError: Cannot set Polygon SpatialProxy (POLYGON) with value of type: <class 'django.contrib.gis.geos.point.Point'> The expected output should be: "type": "FeatureCollection", "features": [ { "type": "Feature", "geometry": { "type": "Point", "coordinates": [..] … -
CreateView with inline form with boolean only fields failing to create
Ok so I have a a generic CreateView with a couple of inlineformset_factory additions. Similar to the examples here: Django class-based CreateView and UpdateView with multiple inline formsets One is generating a new record on save with the parent model as expected, however a second which only contains boolean fields is not. I am not generating my own model form for either inline formset but using the default. As soon as i add a charfield field to the offending model the save works and i can see the new record, with only booleans fields in that inline formset (and model) i get nothing no record and no errors. If anyone can explain why would be awesome. mathew -
Django possible to nest prefetch related?
Suppose I have the following models. class Item(models.Model): seller = models.ForeignKey('seller.Seller') class ItemSet(models.Model): items = models.ManyToManyField("Item", related_name="special_items") What I'd like to do is For a given seller, retrieve all items which is stored as special_items in ItemSet. The following code is what I come up with, havent tried, just a hunch it won't work. :( (I want to retrieve item_founds and item_specials) item_founds = Item.objects.filter(seller=seller).prefetch_related( Prefetch( "special_items", queryset=Items.objects.prefetch_related("items") ) ) item_specials = Item.objects.none() for item_found in item_founds.all(): for special_item in item_found.special_items.all(): item_specials |= special_item.items.all() -
Django 1.10.2 error "NoReverseMatch at " ,"Reverse for 'django.contrib.auth.views.login' with arguments '()' and keyword arguments '{}' not found."
I am new to python & Django... I am getting one error and have absolutely no idea how to solve it... Any help will be appreciated.... from django.shortcuts import render # Create your views here. #log/views.py from django.shortcuts import render from django.contrib.auth.decorators import login_required # Create your views here. # this login required decorator is to not allow to any # view without authenticating @login_required(login_url="login/") def home(request): return render(request,"home.html") The code in urls.py is, from django.conf.urls import include,url from django.contrib import admin from django.contrib.auth import views as auth_views from log.forms import LoginForm urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'', include('log.urls')), url(r'^login/$', auth_views.login ,{'template_name': 'login.html','authentication_form': LoginForm}), url(r'^logout/$', auth_views.logout, {'next_page': '/login'}), The code in login.html is, {% extends 'base.html' %} {% block content %} {% if form.errors %} <p>Your username and password didn't match. Please try again.</p> {% endif %} {% if next %} {% if user.is_authenticated %} <p>Your account doesn't have access to this page. To proceed, please login with an account that has access.</p> {% else %} <p>Please login to see this page.</p> {% endif %} {% endif %} <div class="container"> <div class="row"> <div class="col-md-4 col-md-offset-4"> <div class="login-panel panel panel-default"> <div class="panel-heading"> <h3 class="panel-title">Please Sign In</h3> </div> <div class="panel-body"> <form method="post" … -
Where is the image being uploaded?
I have created a custom User model in django: class CustomUser(AbstractBaseUser, PermissionsMixin): email = models.EmailField(_('email address'), max_length=254, unique=True) first_name = models.CharField(_('first name'), max_length=30) image = models.ImageField(_('profile image'), upload_to='userimages/', default = 'user_default.jpeg') Now I have created a serializer for django-rest-framework to register a new user: class UserRegistrationSerializer(serializers.ModelSerializer): password = serializers.CharField(style={'input_type': 'password'}, write_only=True, validators=settings.get('PASSWORD_VALIDATORS')) image = serializers.ImageField(max_length=None, use_url=True) class Meta: model = User fields = tuple(User.REQUIRED_FIELDS) + ( User.USERNAME_FIELD, User._meta.pk.name, 'image', 'password', ) def create(self, validated_data): if settings.get('SEND_ACTIVATION_EMAIL'): with transaction.atomic(): user = User.objects.create_user(**validated_data) user.is_active = False user.save(update_fields=['is_active']) else: user = User.objects.create_user(**validated_data) return user My media settings are: MEDIA_ROOT = os.path.join(BASE_DIR, 'media') MEDIA_URL = '/media/' My 'urls.py': urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^', include('app.urls')), ]+ static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) Now when I 'POST' on the /register/ endpoint, the User gets created and I am able to see the image in the browser from the url in admin panel. But when I look into my project directory, the image is just not there. I am not able to figure out the image location. I am pretty sure that the image gets uploaded in my computer as I tried uploading it from some other device on LAN and was able to access it (from the browser)after disconnecting … -
Django Admin set extra to 0 when editing
Setting extra = 1 in my model always shows a 1 empty field. It is OK while inserting a new item but I don't want to show an additional empty field while editing. How can I do this? Let's say our model is this: class Foo(models.Model): bar = models.ForeignKey(Bar, models.CASCADE, related_name='bars') title = models.CharField(_('Title'), max_length=255) body = models.TextField(_('Body')) __str__(self): return '%s' % (self.title) class FooInline(admin.StackedInline): model = Foo extra = 1 #Also shows 1 extra empty field while editing. #I don't want to show if there is already a non-empty field class FooAdmin(admin.ModelAdmin): prepopulated_fields = {'slug': ('title',)} inlines = [ FooInline ] -
Django: csrf_token doesn't work after deploy
I deploying my Django project in AWS (nginx, gunicorn) I can access my project through url and looking great. But problem is that I can not send any POST request because of csrf_token error. I just googled it and find looks-good solution : http://www.regisblog.fr/2014/08/31/passing-django-csrf-cookie-nginx/ But it doesn't work after I edited nginx.conf. Here is my nginx.conf (ssl not applying yet and conceal IP address) worker_processes 1; events { worker_connections 1024; accept_mutex off; } http { include mime.types; default_type application/octet-stream; sendfile on; server { listen 80; server_name MY_IP; client_max_body_size 4G; keepalive_timeout 5; #return 301 https://$server_name$request_uri; location / { proxy_pass_header X-CSRFToken; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto https; proxy_set_header X-Real-IP $remote_addr; proxy_set_header HOST $http_host; proxy_set_header X-NginX-Proxy true; proxy_pass http://127.0.0.1:4349; proxy_redirect off; } } } Advice me please, thanks. -
Create a derived class from an existing base class [duplicate]
This question already has an answer here: How to go from a Model base to derived class in Django? 5 answers I need to create in django an object of a derived class from an existing base class. Which would be the right way to do it? class Base() ... class Derived(Base) ... base = Base() base.save() Something like the following, but working fine: derived = Derived(base) # TypeError derived = Derived(base_ptr=base) # Resets Base class fields -
Install Django Applications via admin interface
How can I install re-usable django application via the great admin interface? -
dependent field of others in django admin
I have a model class Essai_Fluage(models.Model): name = models.ForeignKey(Material, verbose_name=_('name')) elongation= models.FloatField(_('allongement'),blank=True, null=False) t_02 = models.IntegerField(_('t_0.2%'),blank=True, null=False) t_05 = models.IntegerField(_('t_0.5%'),blank=True, null=False) t_075 = models.IntegerField(_('t_0.75%'),blank=True, null=False) tr = models.IntegerField(_('tr'),blank=True, null=False) T= models.FloatField(_('temperature'),blank=True, null=False) sigma = models.FloatField(_('contrainte'),blank=True, null=False) PLM = models.FloatField(_('PLM'),blank=True, null=False) rep = models.IntegerField(_('indice'),blank=True, null=True) def __unicode__(self): return '%s' % (self.name) class Meta: verbose_name = _('creep test') verbose_name_plural = _('creep test') ordering = ['rep',] I would like to have the field PLM calculate with the formula PLM = (T/1000)*(20 + log10(tr)) T and tr are the fields T= models.FloatField(_('temperature'),blank=True, null=False) tr = models.IntegerField(_('tr'),blank=True, null=False) in the admin, is it possible to do this ? -
Extending django catridge product causes Grapelli KeyError in admin
I'm currently working on a django / mezzanine / cartridge store. All of my products will have a CAD file and a PDF file, in an effort to stay DRY I have created a BaseProduct model which is defined as follows: models.py class BaseProduct(Product): cadfile = fields.FileField(upload_to="product", extensions=(".dwg",), blank=True, null=True) pdffile = fields.FileField(upload_to="product", blank=True, null=True) objects = SearchableManager() search_fields = ("title", "description") class Meta: abstract = True Additionally, I have other product types that are subclass this base product type as follows. class CorniceProduct(BaseProduct): cornice_picture = fields.FileField(upload_to="product", null=True, blank=True) ceiling_projection = models.IntegerField(null=True, blank=True) wall_height = models.IntegerField(null=True, blank=True) class CeilingRoseProduct(BaseProduct): width = models.IntegerField(null=True, blank=True) height = models.IntegerField(null=True, blank=True) This works as far as models goes, the issue comes with the cartridge admin area, this is mostly derived from the cartridge/shop/admin.py file. admin.py option_fields = [f.name for f in ProductVariation.option_fields()] product_fieldsets = deepcopy(DisplayableAdmin.fieldsets) product_fieldsets[0][1]["fields"].insert(2, "available") product_fieldsets[0][1]["fields"].extend(["content", "categories", "pdffile", "cadfile"]) product_fieldsets = list(product_fieldsets) other_product_fields = [] if settings.SHOP_USE_RELATED_PRODUCTS: other_product_fields.append("related_products") if settings.SHOP_USE_UPSELL_PRODUCTS: other_product_fields.append("upsell_products") if len(other_product_fields) > 0: product_fieldsets.append((_("Other products"), { "classes": ("collapse-closed",), "fields": tuple(other_product_fields)})) product_list_display = ["admin_thumb", "title", "status", "available", "admin_link"] product_list_editable = ["status", "available"] # If variations are used, set up the product option fields for managing # variations. If not, expose the … -
Configuring django in heroku for a lot of requests per minute
I have a instance of django deployed in Heroku as follow, Procfile: web: python manage.py collectstatic --noinput ; gunicorn MY_APP.wsgi --log-file - worker: celery -A MY_APP worker beat: celery -A MY_APP beat This instance can receive 2000-4000 requests per minute, and sometimes it is too much. I know I should change the communications... but can I change something in the configuration to get a 10-30% in the server efficiency? -
force Django to use new connection everytime
I'm using default database setting for Django, and conn_max_age is not set. Hence it must be taking 0 as default. I would like to force Django to use new connection for each request. How do I force Django to use new connection on every request? -
how to save image in django
i have models`class UserProfile(models.Model): user = models.OneToOneField(User) phone_no= models.CharField(max_length=10, null=True) shop_name=models.CharField(max_length=244, null=True) shop_address=models.CharField(max_length=200,null=True,blank=True) city=models.CharField(max_length=20,null=True) country=models.CharField(max_length=20,null=True) abn=models.CharField(max_length=11) website = models.CharField(max_length=200, blank=True, null=True) #last_4_digits = models.CharField(max_length=4, default=False) #stripe_id = models.CharField(max_length=255, default=False) #subscribed = models.BooleanField(default=False) created_at = models.DateTimeField(default=datetime.now, blank=True) updated_at = models.DateTimeField(default=datetime.now, blank=True) Emg_no=models.CharField(max_length=10, null=True,blank=True) area_code=models.CharField(null=True,blank=True,max_length=2) landline_number= models.CharField(null=True,blank=True,max_length=9) payment_date = models.DateTimeField(default=datetime.now, blank=True) status=models.ForeignKey(Status,blank=True,null=True) user_image = models.ImageField(upload_to='user_image') def __str__(self): return self.user.first_name class Meta: db_table = 'registration_userprofile'` i want to save image separately so that i write a form class User_imageForm(forms.Form): user_image = forms.ImageField(required= False) class Meta: model=UserProfile Fields=('user_image') now i want to save the image at given path, my view is @login_required(login_url="/registration/login/") def user_image(request,user_id): print("start of user_image view") server1 = get_object_or_404(User, pk=user_id) print("hiiiiiiiiiiiii") if request.method == 'POST': print("post ") userimage = User_imageForm(request.POST,request.FILES) if userimage.is_valid(): print("form is valid") server1.user_image=userimage.cleaned_data['user_image'] server1.save() print("image save") print(request.user.id) variables=RequestContext(request, {'id':request.user.id}) return redirect('updatedetails', int(request.user.id) ) else: print("form is not valid") userimage = User_imageForm() return render_to_response('registration/profile_try.html') -
How do i check via python/django if a task is running in celery if I only have the task name?
I was assigned recently to an existing django project and one of the tasks assigned to me was to check if there's a task currently running in celery. It's my first time working with celery and I am a little lost as to how to do this. The version of celery being used is 3.1.18. Based on the existing setup of the project, the only resource i have to do this is with the task name. So given the task name, i need to find if that particular task is already executing. The way i was testing the functions was i manually called the tasks in the shell with delay(). When i see that my worker has received the task, i executed the commands i found in the links below to see if i could catch them but i haven't had luck doing this so far. Here's what i've found so far looking through stack overflow How to inspect and cancel Celery tasks by task name I tried the following command from the link above via the python shell task_list = celery.events.state.State().tasks_by_type(task.name) and executed the following loop via the shell for uuid, _ in task_list print(uuid) but it was always … -
How to understand/learn web development as a whole?
I am new to web development and wants to learn the ins and outs of web development. I have done some basic python and mysql tutorials. I am currently learning Django framework. I have very few to zero knowledge on HTML and CSS and zero knowledge on Javascript. As far as I know, these tools are the only requirement to build a website which leads me to my question of learning web development as a whole. I am self studying and I am not a graduate of computer science. I graduated psychology so you can imagine how much struggle it is for me to learn the technicalities of web development. Someone (not expert in python) adviced me to learn Python first then Django framework, so far all is going well. What i need to know now is how to develop my understanding on web development? What are the applications i can do with web development (so far i know that web development can store info on database and can send e-mails)? Are the languages i listed enough for me to do all those applications? I need a checklist/steps (like learn python,then django, then html then css then javascript....etc) to master … -
django 3.5 makemessages make no files
I am running django 1.10 with python 3.5 on windows 7 and I am trying to translate my test files. I have created the es language directory in the locale directory. In the virtual environment, at the command prompt I enter: python manage.py makemessages --locale=es I get the following error message: .... .\manage.py .\requirements.txt.py .\requirements\base.txt.py .\requirements\deployment.txt.py .\requirements\development.txt.py .\requirements\production.txt.py .\runtime.txt.py xgettext: Non-ASCII string at .\env\Lib\sitepackages\compressor\filters\cssmin\rcssmin.py:70. Please specify the source encoding through --from-code. I have seen this post and changed the ascii to utf-8 and even tried utf8. I get the same error message. When I open the file .\env\Lib\sitepackages\compressor\filters\cssmin\rcssmin.py, there is no code on line 70. Here is the relevant portion of the file: Both python 2 (>= 2.4) and python 3 are supported. .. _YUI compressor: https://github.com/yui/yuicompressor/ .. _the rule list by Isaac Schlueter: https://github.com/isaacs/cssmin/ """ if __doc__: # pylint: disable = W0622 __doc__ = __doc__.encode('ascii').decode('unicode_escape') __author__ = r"Andr\xe9 Malo".encode('ascii').decode('unicode_escape') __docformat__ = "restructuredtext en" __license__ = "Apache License, Version 2.0" __version__ = '1.0.6' __all__ = ['cssmin'] import re as _re I have run out of ideas. Does anyone have any suggestions? -
Django - get models ordered by an attribute that belongs to its OneToOne model
Let's say there is one model named User and the other named Pet which has a OneToOne relationship with User, the Pet model has an attribute age, how to get the ten User that owns the top ten oldest dog? class User(models.Model): name = models.CharField(max_length=50, null=False, blank=False) class Pet(models.Model): name = models.CharField(max_length=50, null=False, blank=False) owner = models.OneToOneField(User, on_delete=models.CASCADE) age = models.IntegerField(null=False) -
No JSON object could be decoded - Django request.body
I am making web service for posting comments from smart phone, Below is my code @api_view(['POST']) def comment_post(request,newsId=None): data = json.loads(request.body) responseData= dict({ "result": list() }) if(newsId): commentNews = models.Comments.objects.create() commentNews.comment_description = data.get('comment_description').strip() commentNews.like_count = int(data.get('like_count')) commentNews.user_name = data.get('user_name').strip() commentNews.user_email_id = data.get('user_email_id').strip() commentNews.parent_comment = data.get('parent_comment').strip() commentNews.save() subscribed_user = models.SubscribedUsers.objects.create(username=data.get('user_name').strip(),email=data.get('user_email_id').strip()) news = models.News.objects.get(id=int(newsId)) news.comments.add(commentNews) data ={ 'status':'success' } else: data ={ 'status':'failure' } responseData['result'].append(data) return Response(responseData,status=status.HTTP_200_OK) Whenever i check it on local it works, but on server side it gives me below error ValueError at /service/comment_post/369 No JSON object could be decoded Request Method: POST Request URL: http://dev.newskhabari.com/service/comment_post/369 Django Version: 1.9.5 Exception Type: ValueError Exception Value: No JSON object could be decoded Exception Location: /usr/local/lib/python2.7/json/decoder.py in raw_decode, line 383 Python Executable: /var/www/vhosts/newskhabari.com/newskhabari_dev/newskhabari-app-venv/bin/python Python Version: 2.7.6 Python Path: ['/var/www/vhosts/newskhabari.com/newskhabari_dev/newskhabari-app-venv/lib/python2.7/site-packages', '/var/www/vhosts/newskhabari.com/newskhabari_dev/newskhabari-app-venv/lib/python2.7/site-packages/django', '/var/www/vhosts/newskhabari.com/newskhabari_dev/newskhabari-app-venv/bin', '/var/www/vhosts/newskhabari.com/newskhabari_dev', '/usr/local/rvm/gems/ruby-2.2.2/gems/passenger-5.0.30/src/helper-scripts', '/var/www/vhosts/newskhabari.com/newskhabari_dev/newskhabari-app-venv/lib/python27.zip', '/var/www/vhosts/newskhabari.com/newskhabari_dev/newskhabari-app-venv/lib/python2.7', '/var/www/vhosts/newskhabari.com/newskhabari_dev/newskhabari-app-venv/lib/python2.7/plat-linux2', '/var/www/vhosts/newskhabari.com/newskhabari_dev/newskhabari-app-venv/lib/python2.7/lib-tk', '/var/www/vhosts/newskhabari.com/newskhabari_dev/newskhabari-app-venv/lib/python2.7/lib-old', '/var/www/vhosts/newskhabari.com/newskhabari_dev/newskhabari-app-venv/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7', '/usr/local/lib/python2.7/plat-linux2', '/usr/local/lib/python2.7/lib-tk', '/var/www/vhosts/newskhabari.com/newskhabari_dev/newskhabari-app-venv/lib/python2.7/site-packages', '/var/www/vhosts/newskhabari.com/newskhabari_dev', '/var/www/vhosts/newskhabari.com/newskhabari_dev/app'] Server time: Mon, 17 Oct 2016 11:35:36 +0530 I am unable why it give Exception Value: No JSON object could be decoded -
Django - How to put a html folder into django templates
I have my website built using django framework. Now we know django is a MVC based framework. And now I have a html folder which contains html file generated by doxygen. There are many .html files inside the folder and link each file via "" tag and have image(.png) inside the folder too. I know that django has to set urls to all html pages and put it into templates and also put the image into static file and collect it via "manage.py collectstatics". Is it any easier way to embed the whole html folder into my django project?