background preloader

Python

Facebook Twitter

Amazon s3

3.0 Announcement - Django REST framework. The 3.0 release of Django REST framework is the result of almost four years of iteration and refinement.

3.0 Announcement - Django REST framework

It comprehensively addresses some of the previous remaining design issues in serializers, fields and the generic views. This release is incremental in nature. There are some breaking API changes, and upgrading will require you to read the release notes carefully, but the migration path should otherwise be relatively straightforward. The difference in quality of the REST framework API and implementation should make writing, maintaining and debugging your application far easier. 3.0 is the first of three releases that have been funded by our recent Kickstarter campaign. As ever, a huge thank you to our many wonderful sponsors. New features. Django Rest Framework: Disable field update after object is created. Oauth2 token authentication using django-oauth-toolkit and python-social-auth. Iphone - How to login on ios device with django server? Python - Which authentication to be used when using Django Rest Framework and IOS app?

Learn Python The Hard Way. An important concept that you have to understand is the difference between a class and an object.

Learn Python The Hard Way

The problem is, there is no real "difference" between a class and an object. They are actually the same thing at different points in time. I will demonstrate by a Zen koan: What is the difference between a Fish and a Salmon? Did that question sort of confuse you? This question is confusing because most people do not think about real things this way, but they intuitively understand them. Let's take it one step further. What is the difference between Mary and a Salmon? Again this is a weird question, but it's a bit easier than the Fish versus Salmon question. A Coder, a Programmer, a Hacker, a Developer, and a Computer Scientist walk into a Venn Diagram. Creating themes — Pelican 3.5.0 documentation. To generate its HTML output, Pelican uses the Jinja templating engine due to its flexibility and straightforward syntax.

Creating themes — Pelican 3.5.0 documentation

If you want to create your own theme, feel free to take inspiration from the “simple” theme. To generate your site using a theme you have created (or downloaded manually and then modified), you can specify that theme via the -t flag: If you’d rather not specify the theme on every invocation, you can define THEME in your settings to point to the location of your preferred theme. Templates and variables¶ The idea is to use a simple syntax that you can embed into your HTML pages. All templates will receive the variables defined in your settings file, as long as they are in all-caps. Common variables¶ All of these settings will be available to all templates. Sorting¶ URL wrappers (currently categories, tags, and authors), have comparison methods that allow them to be easily sorted by name: {% for tag, articles in tags|sort %} Date Formatting¶

Packaging and Distributing Projects — Python Packaging User Guide documentation. Initial Files¶ setup.py¶ The most important file is “setup.py” which exists at the root of your project directory.

Packaging and Distributing Projects — Python Packaging User Guide documentation

For an example, see the setup.py in the PyPA sample project. “setup.py” serves two primary functions: It’s the file where various aspects of your project are configured. <your package>¶ Although it’s not required, the most common practice to is to include your python modules and packages under a single top-level package that has the same name as your project, or something very close.

For an example, see the sample package that’s include in the PyPA sample project.

Odoo

Django. Python - pip geoip installing in ubuntu gcc error. Exception handling - Python try-else. How to use *args and **kwargs in Python. How to use *args and **kwargs in Python Or, How to use variable length argument lists in Python.

How to use *args and **kwargs in Python

The special syntax, *args and **kwargs in function definitions is used to pass a variable number of arguments to a function. The single asterisk form (*args) is used to pass a non-keyworded, variable-length argument list, and the double asterisk form is used to pass a keyworded, variable-length argument list. Here is an example of how to use the non-keyworded form. This example passes one formal (positional) argument, and two more variable length arguments. def test_var_args(farg, *args): print "formal arg:", farg for arg in args: print "another arg:", arg test_var_args(1, "two", 3) Results: formal arg: 1 another arg: two another arg: 3 Here is an example of how to use the keyworded form. Def test_var_kwargs(farg, **kwargs): print "formal arg:", farg for key in kwargs: print "another keyword arg: %s: %s" % (key, kwargs[key]) test_var_kwargs(farg=1, myarg2="two", myarg3=3)

SQLAlchemy

YAML Tutorial - Essentials. This website uses cookies to display custom content and advertising.

YAML Tutorial - Essentials

We therefore share information about your use of our site with Google. See details From Essentials YAML Rules Applicable YAML files: all files with a .yml extension. Nbviewer.ipython.org/github/sanand0/ipython-notebooks/blob/master/Faster Data Processing in Python.ipynb. Python decorators finally demystified. Hi there guys!

Python decorators finally demystified

I hope all of you are fine and doing well. Recently I was hanging out on a python related IRC where I got a request from someone to write an article on decorators in Python. It is perhaps one of the most difficult concept to grasp. So as usual without wasting anytime let get on with it. Edit: this article has been published on my other blog where it will be easier for you to read the code. Style Guide for Python Code.

Flask

Code Style. If you ask Python programmers what they like most in Python, they will often say its high readability.

Code Style

Indeed, a high level of readability is at the heart of the design of the Python language, following the recognized fact that code is read much more often than it is written. One reason for Python code to be easily read and understood is its relatively complete set of Code Style guidelines and “Pythonic” idioms.

Moreover, when a veteran Python developer (a Pythonista) points to portions of code and says they are not “Pythonic”, it usually means that these lines of code do not follow the common guidelines and fail to express the intent in what is considered the best (hear: most readable) way. On some border cases, no best way has been agreed upon on how to express an intent in Python code, but these cases are rare. General concepts Explicit code While any kind of black magic is possible with Python, the most explicit and straightforward manner is preferred.

Bad.