Django community: RSS
This page, updated regularly, aggregates Community blog posts from the Django community.
-
Django REST framework (DRF) and Angular 2+ tutorial (Part 2)
This is part 2 of these tutorial series to learn how to use Python Django framework with Angular 2+ (When writing this second tutorial part It's already Angular 4 ) to create Restful or Rest based web apps . Django REST framework (DRF) with Angular 2+ tutorial (Part 1) Django REST framework (DRF) with Angular 2+ tutorial (Part 2) Django REST framework (DRF) with Angular 2+ tutorial (Part 3) There are many frameworks or packages to build Rest APIs with Django .In this tutorial we are going to use Django Rest Framework or DRF which makes the process of building restful APIs dead easy . In the first tutorial part we have seen an introduction to both Django and DRF ,installed Django and DRF then created a new project . In the second part we are going to first see an introduction to Angular 2+ framework ,next we are going to install the Angular CLI utility and then use it to generate our Angular 2+ project,or precisely Angular 4 project when writing this tutorial. What is Angular 2 ? Angular 2+ or officially just Angular is a client side framework built by Google to create Desktop and mobile web apps … -
Django REST framework (DRF) and Angular 2+ tutorial (Part 2)
This is part 2 of these tutorial series to learn how to use Python Django framework with Angular 2+ (When writing this second tutorial part It's already Angular 4 ) to create Restful or Rest based web apps. Django REST framework (DRF) with Angular 2+ tutorial (Part 1) Django REST framework (DRF) with Angular 2+ tutorial (Part 2) Django REST framework (DRF) with Angular 2+ tutorial (Part 3) There are many frameworks or packages to build Rest APIs with Django .In this tutorial we are going to use Django Rest Framework or DRF which makes the process of building restful APIs dead easy . In the first tutorial part we have seen an introduction to both Django and DRF ,installed Django and DRF then created a new project . In the second part we are going to first see an introduction to Angular 2+ framework ,next we are going to install the Angular CLI utility and then use it to generate our Angular 2+ project,or precisely Angular 4 project when writing this tutorial. What is Angular 2 ? Angular 2+ or officially just Angular is a client side framework built by Google to create Desktop and mobile web apps with … -
Uçmak Hayal Değil Gerçek !
Her bütçeye hitap eden Sunexpress uçak bileti fiyatlarını duyunca siz de artık yolculuklarınızda hava yolunu tercih edeceksiniz. Bunun için www.alobilethatti.com sitesine giriş yapmanız ve detaylar hakkında araştırma yapmanız yeterli olacaktır. Uçak ile seyahat etmek artık hayal değil. Çok uygun fiyata bilet fiyatları ile artık herkes hava yolu taşımacılığından yararlanabilmektedir. Yıllar önce uçak biletleri pahalı olduğu... Uçmak Hayal Değil Gerçek ! yazısı ilk önce Python Türkiye üzerinde ortaya çıktı. -
Linux Yaz Kampı 2017
2017 Linux Yaz Kampı Linux Yaz Kampı 2017, 21 Temmuz-5 Ağustos tarihlerinde Bolu’da düzenleniyor. Kampa başvurular 15-30 Haziran tarihleri arasında yapılıyor.   Linux Kullanıcıları Derneği, İnternet Teknolojileri Derneği ve Bolu Abant İzzet Baysal Üniversitesi‘nin organizasyonunu üstlendiği etkinlikte, farklı alanlarda, farklı bilgi düzeylerine hitap eden paralel sınıflarda gerçekleştirilen eğitimlere katılım ücretsizdir. Katılımcılardan yalnızca kendi yol/konaklama/yemek masraflarını... Linux Yaz Kampı 2017 yazısı ilk önce Python Türkiye üzerinde ortaya çıktı. -
Python’da Fonksiyonel Programlamaya Giriş: [1] Nedir, Yenir mi?
{Merhabalar, gençler. Uzun zamandır yazmıyorum. Bunda biraz okulun, biraz da yeni şeyler öğrenmenin katkısı da var. Yazmamamın sebebi de kafamda bir şeyleri oturtmam gerektiği. Bu zaman kendime stack aramakla geçti biraz. Backend stack’ı olgun bir şekilde oturttum, ama frontend stack’ta hala sıkıntılar çekiyorum. Bir backend geliştirici olarak, frontend’in harbi harbi tanrı vergisi olduğunu düşünmeye başladım.... Python’da Fonksiyonel Programlamaya Giriş: [1] Nedir, Yenir mi? yazısı ilk önce Python Türkiye üzerinde ortaya çıktı. -
Python’da Fonksiyonel Programlamaya Giriş: [2] Lambda, Map, Filter, Reduce
Önemli Not: Python 3 kullanıyorum. Bu not, serinin devamı için de geçerlidir. Python’un ikinci sürümünden sonra bu fonksiyonlarda özellikle performans vaadeden radikal değişimler oldu. Bunlara değinmeyeceğim ve üçüncü sürümü kullandığınızı varsayacağım. Özellikle hangi sürüm diye soracak olursanız, 3.5.1 iyidir. Şimdi, geçen yazımızı “Döngülerden kaçınmalıyız, performansta düşüşlere sebep olabiliyor.” demiştik. Öyle, ama konunun biraz daha ayrıntısına inelim. Performans O... Python’da Fonksiyonel Programlamaya Giriş: [2] Lambda, Map, Filter, Reduce yazısı ilk önce Python Türkiye üzerinde ortaya çıktı. -
Django Hızlı ve Basit Site Yayınlama – Djeasy
Django framework ile geliştirilmiş bir web siteyi yayınlamaya kalktığımızda, bir çok teknoloji ile karşılaşiyoruz örneğin; Nginx Gunicorn Uwsgi Supervisor Apache … Bu şekilde devam ediyor ve uygun teknoloji seçip gerekli kurulumları yaparken, baya bir cebelleşiyoruz , el pratiği olan biri için bile django site yayınlama süresi en az 30dk diyebilirim. Bu soruna çözüm bulmak adına Djeasy adlı paketi geliştirmeye başladım ve gerçekten iyi konuma geldi. Kısaca; Nginx ve Gunicorn kullanarak, django sitenizi 2-3dk içerisinde ayağa kaldırmaktadır. Nginx için gerekli css,js vb. sıkıştırma ayarlarından gerekli optimize ayarlarınızda standart olarak eklemektedir. Gunicorn içinde gerekli işçi ayarlamalarını standart olarak ayarlamaktadır. Paket Uyumlulukları Django 1.8+ Python 3.x + Debian Türevleri : Ubuntu vb. Kurulum sudo apt-get install python-pip sudo apt-get install python3-pip sudo apt-get install virtualenvpip3 install djeasy Ayarlar Djeasy paketin doğru çalışması için, belli başlı şartlar bulunmaktadır. Bunları listeleyelim; Proje klasörü içerisinde requirements.txt adlı belge kesinlikle olmadır. Hangi modülleri hangi paketleri kullandıysanız, kesinlikle yazın djeasy otomatik olarak kurmaktadır. Örnek : requirements.txt Django settings.py içerisindeki “ALLOWED_HOSTS = []” içerisinde ip veya domain adresini yazmayı unutmayın. Yukarıda yazdığım, iki adet şart düzgün şekilde uyar iseniz çok hızlı şekilde sonuç alabilirsiniz. Kullanımı Terminal üzerinden, kullanım örneklerine bakalım.djeasyKomutu girdikten sonra, paket hakkında bilgi mesajları gelmektedir.--create Create a … -
Django Framework Nedir?
Web Programçılığı Web sayfalarının giderek yaygınlaşması ve kullanıcı ile etkileşmeye ihtiyacının olması nedeniyle CGI(Common Gateway Interface) ile başladığını söyleyebiliriz. CGI yönetemi ile etkileşimli web sayfaları üretmek oldukça pahalı bir iştir. Çünkü sunucuya CGI programının yapacağı her istek geldiğinde, program çalıştırılır. Dış program derlemeli bir dil ile yazılmış veya yorumlanabilir bir dil ile yazılmış olabilir. Yazılımın öncelik olarak yorumlamalı olduğunu varsayalım : Önce Python çalışır, daha sonra yazılan CGI betiği okunur. Okunan CGI betiği veritabanı bağlantısı kurar ve işi bittiğinde süreç sonlanır. Bu hem yavaş, hem de sunucu üzerinde büyük yük oluşturur. CGI’den daha hızlı çalışan çeşitli yöntemler keşfedilmiştir. En performanslı olanı ise web sunucusu ile bütünleşmiş bir yorumlayıcının dış program kodlarını yorumlamasıdır. Bu durumda sadece betik kodları okur ve işini yapar. Django ve php böyle çalışır ama Django python mod_python veya mod_wsgi modüllerini kullandığı için performansı daha yüksektir. Django Nedir? Web programçılığın kökeni CGI‘ye (Common Gateway Interface) dayanır. CGI’de genel mantık, kullanıcıdan gelen veriyi ya değişkenden ya da standart girdiden alır ve kullanıcıya gidecek tüm veriyi standart çıktıya yazar. CGI bazı durumlarda halen tercih edilse bile, artık web programçılığı tamamen farklı bir boyut kazanmıştır. Php dili gibi kendisini sadece web programcılığına adamış programlama dilleri bile, programcıların web isteklerini karşılamaya yetmemektedir. … -
Python at Instagram (PyCon 2017 Must-See Talk 2/6)
Part two of six in the 2017 edition of our annual PyCon Must-See Series, highlighting the talks our staff especially loved at PyCon. While there were many great talks, this is our team’s shortlist. -
CSV file to Django Models
Handling CSV (comma separated ... -
Sendgrid Email settings for Django
*[Sendgrid](https://sendgrid.c... -
Use Gmail for Email in Django
This is a simple way to setup ... -
Configure Email in Django
Email configuration is simple.... -
How To Show Correct List Item Indexes When Using Pagination in Django
In your Django template put something like this: <ul> {% for object in object_list %} <li>{{ forloop.counter0|add:page_obj.start_index }}. {{ object }}</li> {% endfor %} </ul> Where: object_list - is a list of objects produced by pagination; page_obj - is a page object produced by pagination page_obj ... Read now -
Versioning complex database migrations
Recently, I've been writing lots of raw SQL code that is either a complex ``VIEW``, or a ``FUNCTION``. Much of the time these will be used as the "source" for a Django model, but not always. Sometimes, there are complex functions that need to be run as a trigger in Postgres, or even a rule to execute when attempting a write operation on a view. Anyway, these definitions are all code, and should be stored within the project they belong to. Using Django's migrations you can apply them at the appropriate time, using a ``RunSQL`` statement. Hovewer, you don't really want to have the raw SQL in the migration file. Depending upon the text editor, it may not syntax highlight correctly, and finding the correct definition can be difficult. Similarly, you don't want to just have a single file, because to recreate the database migration sequence, it needs to apply the correct version at the correct time (otherwise, other migrations may fail to apply). Some time ago, I adopted a policy of manually versioning these files. I have a pattern of naming, that seemed to be working well: special_app/ migrations/ __init__.py 0001_initial.py 0002_update_functions.py sql/ foo.function.0001.sql foo.function.0002.sql foo.trigger.0001.sql bar.view.0001.sql The contents … -
How to get a list of all user permissions available in Django based project
Django comes with a simple permissions system. It provides a way to assign permissions to specific users and groups of users. The system adds "change, remove and add" permissions automatically to every model class. And it's pretty easy to add custom permissions to a model class, like this: class ... Read now -
Interview with Rivo Laks about Docker
This is an interview I took from Estonian Django developer Rivo Laks about Docker. Recorded in DjangoCon EU 2017, Florence, Italy. https://djangodeployment.com/wp-content/uploads/2017/05/rivo.mp3 A: Hello everyone, this is Antonis from djangodeployment.com. The date is 7 April 2017 and I am in Florence, Italy, at the European Django conference. I’m sitting with Rivo Laks, who is a developer from Estonia. He has a company called Thorgate, and we are going to be talking about Docker and similar things, mostly about deployment. Hello Rivo, how do you like the conference? R: Hello Antonis. I like it a lot and I think it’s my fifth DjangoCon now, so it’s been a pleasant experience throught the years. A: That’s very interesting because it’s actually my first Django conference. So what do you think it is that brings you here? R: I guess it’s the people, most importantly; and also the fact that this is a good place to keep you up to date with everything that is going on in the Django world. A: Would you like to tell me some examples of Django applications that your company makes? R: Well, it usually begins with some sort of business problem. One recent example is … -
Creating Smaller Docker Images Part #3: Alpine Linux
This is the third post in a series on making smaller Docker images. In the first post I talked about how to create smaller images by writing better Dockerfiles. In the second post I talked about how to squash layers using docker-squash to make smaller images. These methods are great but they won't help us if we choose large base images to start with! Let's look at the example from the second post, the standard `python` image on Docker hub. If we look at the Dockerfile for this image, as of this writing, it's based on a Debian jessie base image. FROM buildpack-deps:jessie [...] -
Creating Smaller Docker Images Part #3: Alpine Linux
This is the third post in a series on making smaller Docker images. In the first post I talked about how to create smaller images by writing better Dockerfiles. In the second post I talked about how to squash layers using docker-squash to make smaller images. These methods are great but they won't help us if we choose large base images to start with! Let's look at the example from the second post, the standard `python` image on Docker hub. If we look at the Dockerfile for this image, as of this writing, it's based on a Debian jessie base image. FROM buildpack-deps:jessie [...] -
On Conference Speaking
I’ve seen quite a bit of the world thanks to being invited to speak at conferences. Since some people are under the impression that serial conference speakers possess some special talents, I’d like to demystify my process by walking you through my latest talk from start to finish. -
How to Stop Worrying and Start Coding: Self-Help Tips for Developing a Web Front-End
During the four years I’ve worked as a front-end developer, I’ve gained a great deal of experience coding HTML pages. Today, I’m going to share some of that with you. Let’s imagine that you have just received a designer’s layout of a landing page — for a business card website, for example, or an administrative panel dashboard. Where do you start and how do you put everything in its proper place? Let’s find out! The post How to Stop Worrying and Start Coding: Self-Help Tips for Developing a Web Front-End appeared first on Distillery. -
Django REST Framework: JSON Web Tokens (JWT)
Our last post was about Authentication and Permissions and we covered the available methods of authentication in Django REST Framework. In that post, we learned how to use the built in Token based authentication in DRF. In this post, we will learn more about JSON Web Tokens aka JWT and we will see if JWT can be a better authentication mechanism for securing our REST APIs. Understanding JSON Web Tokens (JWTs) We have actually written a detailed blog post about JSON Web Tokens earlier. In case you have missed it, you probably should read it first. We have also described how to use JWT with Flask – reading that one might also help better understand how things work. And of course, we will briefly cover the idea of JWT in this post as well. If we want to put it simply – you take some data in JSON format, you hash it with a secret and you get a string that you use as a token. You (your web app actually) pass this token to the user when s/he logs in. The user takes the token and on subsequent requests, passes it back in the “Authorization” header. The web app … -
Django 1.11 : Create or start your first project
Django is a Python based framework which offers developers all they need to create a web apps and websites in a clean ,rapid and a pragmatic way . How do I start a Django project ? is the first quesion which gets asked by a beginner Django developer so lets answer it . Tutorial requirements To better grasp this tutorial ,you need to have some Python experience and also how to work with Linux bash commands or Windows command prompt if you are using Windows for development . Development requirements Before you can create or start a Django project you need to have you development environment setup . Here is what you need to install before continuing with this tutorial : Python 2.7.x or 3.4.x PIP package manager Virtualenv Django Code editor (Sublime,gedit etc.) If you are using a Linux/MAC machine you should have Python already installed . You can check that running the following command on your terminal python -v If you don't have Python installed head over to Python download page PIP is a Python package manager used to easily install Python packages and their dependencies .You can install PIP using curl utility curl "https://bootstrap.pypa.io/get-pip.py" -o "get-pip.py" python … -
Create an Ionic 3 mobile app with Python Django as backend
In this two parts tutorial ,we are going to recreate our previous Ionic 3 product inventory manager application which used a local SQLite database to use a Python Django backend . -
Django 1.11 : Create super user for Admin back office
After you successfully created your first project with Django 1.11 ,created an app and migrated your SQlite database .It's time to access the admin interface or back office generated automatically by Django which you can use to create ,delete ,edit and list your database tables data . You can visit the admin interface from http://localhost:8200/admin You'll be presented with a form to enter your username and password credentials .If you enter any values you'll get a message : Please enter the correct username and password for a staff account. Note that both fields may be case-sensitive. Since you have no staff user created yet but don't worry this can be fixed with one command . Head over to your terminal ane run : python manage.py createsuperuser You'll be prompted for a username and a password (twice) ,enter them and hit Enter . Next run your local server again : python manage.py runserver Then visit your admin interface http://localhost:8200/admin and enter your credentials then hit Login button . You should be successfully logged in .