Tags » Django

Ask Search Engines to not Index

Every so often you have parts of your website that would be better off not indexed by search engines. API calls, search result page, PDF documents — all example of responses which may not have value outside of current user. 222 more words

Python

Django, Developing Dully: AJAX requests with no cookies

Django provides a convenient way to protect your forms against Cross Site Request Forgery (CSRF), using tokens. The problem comes when you try to use AJAX to post forms (for example, via API), it throws… 294 more words

Backend

ubuntu, django, gunicorn, nginx

sudo apt-get install nginx python-pip libpq-dev supervisor

export LC_ALL=C

sudo pip install django gunicorn psycopg2

Open:

sudo nano /etc/nginx/sites-available/default

Paste:

server {
listen 80;
server_name 192.168.23.109;

106 more words

Doker Vecernjeg. Uzmi jedan od sto tutoriala i 6 dodatnih problema

Problem prvi: Environment varijable u aplikaciji losa su praksa!

A mi zelimo nase kontejnere i u produkciji, ne odmah, ali nekad.
Ovo je jedna vrlo zanimljiva pojava u svijetu programiranja. 1,264 more words

writing simple django decorator

Code, which redirects by trigger:

def simple_subdomain_redirect(function):
    def wrap(request, *args, **kwargs):
        if 'blabla' in request.build_absolute_uri():
            return redirect(request.path + 'bla_bla', permanent=True)
        return function(request, *args, **kwargs)
    return wrap

Stumbling to Package a Django App

Django applications can be packaged individually for reuse. Documentation on how to do so from start to finish seemed either old, sparse, or incomplete. This was my adventure and solution.

2,020 more words