--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Yes, Django is free open source web framework for Python
Django closely follows the MVC (Model View Controller) design pattern, however, it does use its own logic in the implementation. Because the “C” is handled by the framework itself and most of the excitement in Django happens in models, templates, and views, Django is often referred to as an MTV framework. In the MTV development pattern:
Further reading https://djangobook.com/model-view-controller-design-pattern/
According to https://en.wikipedia.org/wiki/Django_(web_framework), Django was created in the fall of 2003, when the web programmers at the Lawrence Journal-World newspaper, Adrian Holovaty and Simon Willison, began using Python to build applications. It was released publicly under a BSD license in July 2005. The framework was named after guitarist Django Reinhardt.
As Django is Python Framework, in order to install Django Python is required.Django comes with an inbuilt lightweight web server that you can use for the testing purpose.If you are using Django on production Apache with mod_wsgi is required.
Django officially supports four database backends, they are
In addition to these, you can also use following 3rd parties
Installing using pip is the recommended way to install Django Framework. Below are the steps to install official release of Django with pip
Follow the below steps to Install the development version of Django Framework.
$ git clone https://github.com/django/django.git
$ pip install -e django/
Source:https://docs.djangoproject.com/en/2.0/topics/install/
You can think Django Migrations as version control sytem for your database/Model.It keep track of changes done in your application Models/Table like adding a field, deleting a model, etc. Migrations in Django are stored as an on-disk format, referred to here as “migration files”. These files are actually just normal Python files with an agreed-upon object layout, written in a declarative style.
A basic migration file looks like this:
from django.db import migrations, models class Migration(migrations.Migration): dependencies = [('migrations', '0001_initial')] operations = [ migrations.DeleteModel('Tribble'), migrations.AddField('Author', 'rating', models.IntegerField(default=0)), ]
Further Reading https://docs.djangoproject.com/en/2.0/topics/migrations/
In Django whenever a request is made by a user, it goes through following steps:
Iterators are used for traversing an object in Python which implements iterator protocol. It consists of two methods __iter__() and next().
In Django, a good use of iterator is when you are processing results that take up a large amount of available memory (lots of small objects or fewer large objects).
For more clarification please read when to use and when to not use iterator() in the Python Django ORM
https://stackoverflow.com/questions/12681653/when-to-use-or-not-use-iterator-in-the-django-orm
In Django, a QuerySet can be evaluated in Iteration, Slicing, Pickling/Caching, repr(),len(), list() and bool().
By running below command on Terminal.You can check installed version of Django Framework.
py -m django --version
Setting Session in Django
request.session['key'] = 'value'
Unset Session in Django
del request.session['key']
In Django Context is a dictionary with variable names in the form of key and value like {varible1: 101, varible2: 102},when we pass this context to the template render method, {{ varible1 }} would be replaced with 101 and {{ varible2 }} with 102 in your template.
A mixin is a special kind of multiple inheritance in Python. There are two main situations where mixins are used:
Read More from https://stackoverflow.com/questions/533631/what-is-a-mixin-and-why-are-they-useful
You can use {{ request.path }} and {{ request.get_full_path }} to get current page URI in Django template
Following are the list of top 10 websites built on Django framework.
To create a constant in Django. Open your settings.py file and add a variable like MY_CONST = “MY_VALUE”.
To use this constant in your views simply import setting like “Import settings in views.py” and use it as
settings.MY_CONST
Read More from https://www.onlineinterviewquestions.com/django-interview-questions/
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/d63c1465-dcb5-403f-8687-e9fd54e96682%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.