Django

Even though you use Django, use Jinja2 as the template engine

  • Posted on: 8 September 2017
  • By: oon
Use Jinja2 with Django

just because of this [1]:

For nearly all cases, Django’s built-in template language is perfectly adequate. However, if the bottlenecks in your Django project seem to lie in the template system and you have exhausted other opportunities to remedy this, a third-party alternative may be the answer.

Jinja2 can offer performance improvements, particularly when it comes to speed.

Hosting Django on Google App Engine with djangae for FREE

  • Posted on: 29 May 2017
  • By: oon
Django Free Hosting on Google App Engine

note: this post based on my experience hosting Django on Google App Engine. FREE on this article means I didn't have any billing every month, it's only personal site with not-too-much load or traffic. BUT, I set this with "activated billing setting" on my Google Cloud account, still have no time to try without activate billing.

This article written in Bahasa Indonesia.

Django Rilis Terakhir untuk Python Versi 2

  • Posted on: 4 April 2017
  • By: oon
Django 1.11 is the last to support Python 2

Django 1.11 LTS rilis di bulan April 2017 merupakan seri Django terakhir yang mendukung Python versi 2.x, selanjutnya Django hanya akan dibuat untuk mendukung Python versi 3.x.

Tapi tidak perlu kuatir, soalnya versi LTS ini setidaknya didukung sampai 3 tahun untuk versi update keamanannya.

Cukup banyak update dari versi ini, lengkapnya bisa dilihat di tautan [1].

Django versi LTS sebelumnya yaitu 1.8, dirilis bulan April 2015 (2 tahun sebelumnya), dan akan berakhir dukungan pembaruan keamanannya April 2018, 3 tahun setelah rilis.

 

SELinux for nginx connect to gunicorn

  • Posted on: 7 January 2017
  • By: oon
SELinux on CentOS

Biasanya saya sering menonaktifkan SELinux begitu pertama kali masuk ke console linux yang diinisialisasi oleh penyedia cloud.

Kali ini ingin mencoba bagaimana mengaktifkan setting SELinux hanya agar nginx bisa connect ke gunicorn socket file saat memberikan layanan untuk Django.

Oke semua bermula dari log nginx:

Django File Upload but request.FILES empty?

  • Posted on: 25 September 2016
  • By: oon
Django File Upload

This is simple but annoying error, when you setting up Django form with File Upload, after you successfully upload the file, but when you check the request.FILES was empty.

What happened?

One of the answer is you probably forget to set encoding type of your form

<form action="" method="post" enctype="multipart/form-data">{% csrf_token %}
{{ form.as_p }}
<button type="submit">{% trans 'Submit' %}</button>
</form>

source [1]

Django Edit or Delete Permission

  • Posted on: 18 April 2016
  • By: oon
Django Edit or Delete Permission

If you add Permission in Django via Meta or programatically [1], then you realized that you need to edit or even delete the permission.

How to edit or delete Permissions?

If you are really sure you want to edit or delete it with any risk, you can add Permission to your admin page. [2]

from django.contrib.auth.models import Permission
admin.site.register(Permission)

and of course you should change (or delete it) first on your model or code.

Pages