Django community: RSS
This page, updated regularly, aggregates Community blog posts from the Django community.
-
Painless Travis CI/CD for Android Project
If you still want your fancy new mobile projects to be continuously tested and pull-requests checked automatically without wanting to spend your entire evening resolving Travis issues, we at Distillery have a solution. The post Painless Travis CI/CD for Android Project appeared first on Distillery. -
Python F-Strings Are Fun!
In python 3.6 we saw the adoption of Literal String Interpolation, or as they are known more commonly, f-strings. At first I was hesitant because... well... we've got multiple string tools already available: one, two = 1, 2 _format = '{},{}'.format(one, two) _percent = '%s,%s' % (one, two) _concatenation = str(one) + ',' + str(two) _join = ','.join((str(one),str(two))) assert _format == _percent == _concatenation == _join Adding f-strings to this mix didn't seem all that useful: _fstring = f'{one},{two}' assert _fstring == _format == _percent == _concatenation == _join I was doubtful, but then I tried out f-strings on a non-trivial example. Now I'm hooked. Be it on local utility scripts or production code, I now instinctively gravitate toward their usage. In fact, f-strings are so useful that going back to earlier versions of Python now feels cumbersome. The reason why I feel this way is that f-strings are concise but easy to understand. Thanks to intuitive expression evaluation I can compress more verbose commands into smaller lines of code that are more legible. Take a look: _fstring = f'Total: {one + two}' # Go f-string! _format = 'Total: {}'.format(one + two) _percent = 'Total: %s' % (one + two) … -
Python F-Strings Are Fun!
In python 3.6 we saw the adoption of Literal String Interpolation, or as they are known more commonly, f-strings. At first I was hesitant because... well... we've got multiple string tools already available: one, two = 1, 2 _format = '{},{}'.format(one, two) _percent = '%s,%s' % (one, two) _concatenation = str(one) + ',' + str(two) _join = ','.join((str(one),str(two))) assert _format == _percent == _concatenation == _join Adding f-strings to this mix didn't seem all that useful: _fstring = f'{one},{two}' assert _fstring == _format == _percent == _concatenation == _join I was doubtful, but then I tried out f-strings on a non-trivial example. Now I'm hooked. Be it on local utility scripts or production code, I now instinctively gravitate toward their usage. In fact, f-strings are so useful that going back to earlier versions of Python now feels cumbersome. The reason why I feel this way is that f-strings are concise but easy to understand. Thanks to intuitive expression evaluation I can compress more verbose commands into smaller lines of code that are more legible. Take a look: _fstring = f'Total: {one + two}' # Go f-string! _format = 'Total: {}'.format(one + two) _percent = 'Total: %s' % (one + two) … -
Two Scoops of Django 1.11 is Out!
When we started the Two Scoops of Django project back in 2012, I never thought it would become a book series. Well, it's turned into just that, and so I'm pleased to announce the "Early Release" or "BETA" release of the Two Scoops of Django: Best Practices for Django 1.11 PDF ebook. Co-authored with Audrey Roy Greenfeld, the 1.11 edition of Two Scoops of Django is filled to the brim with knowledge to help make Django projects better. We introduce various tips, tricks, patterns, code snippets, and techniques that we've picked up over the years. What we didn't know or weren't certain about, once again we found the best experts in the world and asked them for the answers. Then we packed the result into a 530+ page book. What's Next? We'll be adding more material to the 1.11 edition in the near future, hence the term, "Early Release". Everyone who buys the 1.11 ebook from us gets all 1.11 ebook updates. Once we're happy with the ebook, we'll release a print paperback edition, scheduled for May or June. We're selling the book in PDF format, as well as taking pre-orders for the print edition. Order You can purchase the … -
Two Scoops of Django 1.11 is Out!
When we started the Two Scoops of Django project back in 2012, I never thought it would become a book series. Well, it's turned into just that, and so I'm pleased to announce the \"Early Release\" or \"BETA\" release of the Two Scoops of Django: Best Practices for Django 1.11 PDF ebook. Co-authored with Audrey Roy Greenfeld, the 1.11 edition of Two Scoops of Django is filled to the brim with knowledge to help make Django projects better. We introduce various tips, tricks, patterns, code snippets, and techniques that we've picked up over the years. What we didn't know or weren't certain about, once again we found the best experts in the world and asked them for the answers. Then we packed the result into a 530+ page book. What's Next? We'll be adding more material to the 1.11 edition in the near future, hence the term, \"Early Release\". Everyone who buys the 1.11 ebook from us gets all 1.11 ebook updates. Once we're happy with the ebook, we'll release a print paperback edition, scheduled for May or June. We're selling the book in PDF format, as well as taking pre-orders for the print edition. Order You can purchase the … -
Newsletter #6
Welcome to the latest news about Two Scoops Press, Daniel Roy Greenfeld (pydanny), and Audrey Roy Greenfeld (audreyr). Two Scoops of Django 1.11 Early Release Is Out We just released the early release (BETA) of the fourth edition of Two Scoops of Django. This supports the Django 1.11 Long Term Support (LTS) release, which will be maintained until at least April of 2020. In late May, we plan to release the print paperback version. Today you can purchase the early release PDF as well as pre-order the print edition by itself or as a bundle with the PDF. Two Scoops of Django 1.11 in our shop If you have any questions, please read the Two Scoops of Django 1.11 FAQ. Two Scoops Press Legacy Sale For the first time since 2013, we're running a sale! We uncovered two boxes, one that contained several hardcover editions of Two Scoops of Django 1.6, and the other was a set of Two Scoops of Django 1.8 misprints (slight alignment oddities, minor cover coloration issues, or light scuffing). They are on sale for as long as our supplies last. Two Scoops of Django 1.6 Hardcover ($30 off) Two Scoops of Django 1.8 Misprint + … -
Newsletter #6
Welcome to the latest news about Two Scoops Press, Daniel Roy Greenfeld (pydanny), and Audrey Roy Greenfeld (audreyr). Two Scoops of Django 1.11 Early Release Is Out We just released the early release (BETA) of the fourth edition of Two Scoops of Django. This supports the Django 1.11 Long Term Support (LTS) release, which will be maintained until at least April of 2020. In late May, we plan to release the print paperback version. Today you can purchase the early release PDF as well as pre-order the print edition by itself or as a bundle with the PDF. Two Scoops of Django 1.11 in our shop If you have any questions, please read the Two Scoops of Django 1.11 FAQ. Two Scoops Press Legacy Sale For the first time since 2013, we're running a sale! We uncovered two boxes, one that contained several hardcover editions of Two Scoops of Django 1.6, and the other was a set of Two Scoops of Django 1.8 misprints (slight alignment oddities, minor cover coloration issues, or light scuffing). They are on sale for as long as our supplies last. Two Scoops of Django 1.6 Hardcover ($30 off) Two Scoops of Django 1.8 Misprint + … -
Newsletter #6
Welcome to the latest news about Two Scoops Press, Daniel Roy Greenfeld (pydanny), and Audrey Roy Greenfeld (audreyr). Two Scoops of Django 1.11 Early Release Is Out We just released the early release (BETA) of the fourth edition of Two Scoops of Django. This supports the Django 1.11 Long Term Support (LTS) release, which will be maintained until at least April of 2020. In late May, we plan to release the print paperback version. Today you can purchase the early release PDF as well as pre-order the print edition by itself or as a bundle with the PDF. Two Scoops of Django 1.11 in our shop If you have any questions, please read the Two Scoops of Django 1.11 FAQ. Two Scoops Press Legacy Sale For the first time since 2013, we're running a sale! We uncovered two boxes, one that contained several hardcover editions of Two Scoops of Django 1.6, and the other was a set of Two Scoops of Django 1.8 misprints (slight alignment oddities, minor cover coloration issues, or light scuffing). They are on sale for as long as our supplies last. Two Scoops of Django 1.6 Hardcover ($30 off) Two Scoops of Django 1.8 Misprint + … -
Newsletter #6
Welcome to the latest news about Two Scoops Press, Daniel Roy Greenfeld (pydanny), and Audrey Roy Greenfeld (audreyr). Two Scoops of Django 1.11 Early Release Is Out We just released the early release (BETA) of the fourth edition of Two Scoops of Django. This supports the Django 1.11 Long Term Support (LTS) release, which will be maintained until at least April of 2020. In late May, we plan to release the print paperback version. Today you can purchase the early release PDF as well as pre-order the print edition by itself or as a bundle with the PDF. Two Scoops of Django 1.11 in our shop If you have any questions, please read the Two Scoops of Django 1.11 FAQ. Two Scoops Press Legacy Sale For the first time since 2013, we're running a sale! We uncovered two boxes, one that contained several hardcover editions of Two Scoops of Django 1.6, and the other was a set of Two Scoops of Django 1.8 misprints (slight alignment oddities, minor cover coloration issues, or light scuffing). They are on sale for as long as our supplies last. Two Scoops of Django 1.6 Hardcover ($30 off) Two Scoops of Django 1.8 Misprint + … -
SSL/TLS Settings for Django
Let's make your Django project... -
S3 Static & Media Files for Django
Using Amazon Web Services (AWS... -
The luxury of a creative community
The last few months of Evennia development have mainly focused around a series of very nice pull requests from a growing cadre of contributors. I have myself mainly been working away in Evennia's 'devel' branch which will lead up to Evennia 0.7.Contributed goodnessPeople have put in a lot of good work to boost Evennia, both by improving fixing existing things and by adding new features (small selection). Thanks a lot everyone!Contrib: Turn-based combat system - this is a full, if intentionally bare-bones implementation of a combat system, meant as a template to put in your particular game system into.Contrib: Clothing sytem - a roleplaying mechanic where a character can 'wear' items and have this show in their descriptions. Worn items can also be layered to hide that underneath. Had plenty of opportunities for extensions to a given game.Contrib: An 'event' system is in the works, for allowing privileged builders to add dynamic code to objects that fires when particular events happen. The PR is not yet merged but promises the oft pondered feature of in-game coding without using softcode (and notably also without the security of softcode!). A lot of PRs, especially from one user, dealt with cleanup and adherence … -
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... Django Framework Nedir? yazısı ilk önce Python Türkiye üzerinde ortaya çıktı. -
Testing django template tags
In this blog post I will give you simple example how to test your template tags in django using django testing tools. Let's get started! How to test templatetags? Let say that you got this template tag under /templatetags/create_header.py in django: from django import template register = template.Library() @register.inclusion_tag('example.html', takes_context=True) def make_header(context): return { 'header_title': context['title'] } This make_header tag will take the title from context and pass it template tag. Right after that example.html will be rendered. If you want to test if this template tag works you can use this: from django.test import SimpleTestCase from django.template import Context, Template class CreateHeaderTemplateTagTest(SimpleTestCase): def test_rendered(self): context = Context({'title': 'my_title'}) template_to_render = Template( '{% load create_header %}' '{% make_header %}' ) rendered_template = template_to_render.render(context) self.assertInHTML('<h1>my_title</h1>', rendered_template) What is happening here? I setup Context instance with a proper variable that will be taken by templatetag. After that I create Template. I used the same syntax to include templatetags inside your html files - they are templates for Django. Below I render a template with context and check if my templatetag renders correctly. And that's all! I have my templatetag tested. Feel free to comment! Cover image from Unsplash under CC0. -
Testing django template tags
In this blog post I will give you simple example how to test your template tags in django using django testing tools. Let's get started! How to test templatetags? Let say that you got this template tag under /templatetags/create_header.py in django: from django import template register = template.Library … -
Release the GitKraken!
The world of information technology is constantly developing and expanding, forcing myself and many other developers to learn new technologies and read smart books on a regular basis. Some people say that a programmer is reaching maturity when he or she starts to learn a second programming language. The post Release the GitKraken! appeared first on Distillery. -
Django ORM operations compared with Peewee
I saw a post in my weekly Python newsletter showing Django users how to execute common queries using SQLAlchemy. Here's the Peewee version. Setup Assume we have a Django model that looks like the following: class Country(models.Model): name = models.CharField(max_length=255, unique=True) continent = models.CharField(max_length=50) In Peewee, our table definition looks almost identical: from peewee import * # Peewee defines __all__, so import * is common practice. class Country(Model): name = CharField(unique=True) # Default max_length of 255. continent = CharField(max_length=50) Because Peewee does not have a singleton, application-wide database configuration, we also need to associate our model with a database. A common convention, when working with more than one table, is to define a base Model class which configures the database. This will save you a lot of typing when you have more than one model: from peewee import * from playhouse.pool import PooledPostgresqlDatabase db = PooledPostgresqlDatabase('my_app') class BaseModel(Model): class Meta: database = db class Country(BaseModel): name = CharField(unique=True) # Default max_length of 255. continent = CharField(max_length=50) To create tables, call the db.create_tables() method, passing in a list of tables. Peewee will re-order the tables so that they are created in the correct order if you have foreign-keys. def create_tables(): db.connect() … -
Django Tips & Tricks #7 - Django Auth Plugin For HTTPie
HTTPie is an alternative to curl for interacting with web services from CLI. It provides a simple and intuitive interface and it is handy to send arbitrary HTTP requests while testing/debugging APIs. When working with web applications that require authentication, using httpie is difficult as authentication mechanism will be different for different applications. httpie has in built support for basic & digest authentication. To authenticate with Django apps, a user needs to make a GET request to login page. Django sends login form with a CSRF token. User can submit this form with valid credentials and a session will be initiated. Establish session manually is boring and it gets tedious when working with multiple apps in multiple environments(development, staging, production). I have written a plugin called httpie-django-auth which automates django authentication. It can be installed with pip pip install httpie-django-auth By default, it uses /admin/login to login. If you need to use some other URL for logging, set HTTPIE_DJANGO_AUTH_URL environment variable. export HTTPIE_DJANGO_AUTH_URL='/accounts/login/' Now you can send authenticated requests to any URL as http :8000/profile -A=django --auth='username:password' -
Python PIP local cache
PIP is the Python Package Manager that allows Python developers and users to easily install Python packages published on the pip remote register by other developers . If you are using the pip manager frequently then you may find this quick tip useful ,where I'll show how you can activate or enable the local cache of pip which is going to boost the download speed of pip packages . The idea behind the pip cache is simple ,when you install a Python package using pip for the first time ,it gets saved on the cache .If you try to download/install the same version of the package on a second time ,pip will just use the local cached copy instead of retrieving it from the remote register . Enabling the local cache of pip Enabling the local cache of pip is fairly simple so let's do it step by step . First open the pip configuration file located at ~/.pip/pip.conf with your preferred text editor . vim ~/.pip/pip.con On Windows %HOME%\pip\pip.ini The configuration file can be also located in ~/.config/pip/pip.conf or in /etc/pip.conf There also legacy per user config files for PIP which are located in : $HOME/.pip/pip.conf on Unix and … -
Python PIP local cache
PIP is the Python Package Manager that allows Python developers and users to easily install Python packages published on the pip remote register by other developers . If you are using the pip manager frequently then you may find this quick tip useful ,where I'll show how you can activate or enable the local cache of pip which is going to boost the download speed of pip packages . The idea behind the pip cache is simple ,when you install a Python package using pip for the first time ,it gets saved on the cache .If you try to download/install the same version of the package on a second time ,pip will just use the local cached copy instead of retrieving it from the remote register . Enabling the local cache of pip Enabling the local cache of pip is fairly simple so let's do it step by step . First open the pip configuration file located at ~/.pip/pip.conf with your preferred text editor . vim ~/.pip/pip.conf Then copy and add this [global] download-cache=/usr/local/pip/cache Next create the folder mkdir -p /usr/local/pip/cache Then give it write access chmod -R 755 /usr/local/pip/cache You can instead use your profile config file ~/.bash_profile So … -
Python and Django Beginner's Pack: books, tutorials, newsletters
I bet a fresh job offer will make anyone a bit happier and more self-confident. Still, most of us had at least a single denied CV or failed interview. If this is the case, consider it as a sort of new experience. This article is intended for a person who'd like to become an intern in a software development company. Here in Django Stars if a candidate fails to pass the interview due to the lack of knowledge, we always provide the list of useful tutorials and books, that can help him or her to improve the coding skills. You don’t need to pass every single course completely. It’s better to start from the very basic tutorials and do a lot of practice(little Python scripts and eventually a simple Django app). And one more very important note: whenever you learn a new concept, data type, class or function, don’t forget to check the official documentation. One day you won’t need anything than the documentation. So far it's a good idea to briefly look it through. So here is our top 10 books and tutorial we recommend for novice programmers or those seeking to become an intern or junior Python/Django Developer: … -
Recap of DjangoConEurope 2017
"DjangoCon, why is everybody wearing this t-shirt?" wondered the security guys in the airport of Florence, Italy, in the beginning of April. The reason for that was DjangoCon Europe 2017 happening there for a week, full of interesting talks in an exciting location. What I liked, was that the conference was not only about technical novelties in Django world, but also about human issues that programmers deal with in everyday life. Interesting Non-tech Topics According to a manifest, the conference had a goal to strengthen the Django community and to shape responsible attitude towards the works done with Django. Healthy and Successful Community We have to build stronger communities including everyone who wants to participate without discrimination. Although, at first, it might be difficult as people have biases, i.e. prejudices for or against one person or group; by being emphatic we can accept and include everyone no matter what is their gender identity or expression, sexual orientation, ethnicity, race, neurodiversity, age, religion, disabilities, geographical location, food diversities, body size, or family status. Valuing diversity and individual differences is the key for a healthy, positive and successful community, that empowers its members and helps them grow stronger and happier. Responsibility for … -
DjangoCon 2017
I love DjangoCon. I've been going to it almost every year since I arrived in Europe back in 2010. Sure, a considerable portion of my career has been based on Django, but it's more than that: the community is stuffed full of amazing people who genuinely want us all to succeed and that just makes the conference all the more exciting. This year we all converged on Florence for three days of talks in a historic old theatre at the heart of the city and like every year, the talks at this single-track event were hit-and-miss -- but that's ok! When the talks were less-than-useful we could always just pop out for gelato or catch up in the hallways with other developers. The Good Community From talks covering gender bias or autism, to the re-labelling of all bathrooms to be unisex, DjangoCon has long been a shining example of how to be inclusive in a software development community and it's something I'm proud to be a part of. This year, they even raised enough money to pay for flights and accommodation for a number of people from Zimbabwe who are trying to grow a local Django community. It feels good … -
DjangoCon 2017
I love DjangoCon. I've been going to it almost every year since I arrived in Europe back in 2010. Sure, a considerable portion of my career has been based on Django, but it's more than that: the community is stuffed full of amazing people who genuinely want us all to succeed and that just makes the conference all the more exciting. This year we all converged on Florence for three days of talks in a historic old theatre at the heart of the city and like every year, the talks at this single-track event were hit-and-miss -- but that's ok! When the talks were less-than-useful we could always just pop out for gelato or catch up in the hallways with other developers. The Good Community From talks covering gender bias or autism, to the re-labelling of all bathrooms to be unisex, DjangoCon has long been a shining example of how to be inclusive in a software development community and it's something I'm proud to be a part of. This year, they even raised enough money to pay for flights and accommodation for a number of people from Zimbabwe who are trying to grow a local Django community. It feels good … -
Using ProtoBuf for Huge Object Serialization
We at Distillery faced a problem that the size of Memcached objects is huge. We’ve come close to exceeding the Memcached server storage limit which can trigger eviction of objects, putting more load on the databases. The purpose of this investigation is to find a way to reduce the size of Memcached objects which will lead to less traffic from IIS to Memcached servers. The post Using ProtoBuf for Huge Object Serialization appeared first on Distillery.