Django | Set up environment variables in Django   1. Install Django Environ In your terminal, inside the project directory, type: $ pip install django-environ 2. Import environ in settings.py import environ 3. Initialise environ …

Last updated 4 years, 2 months ago | 1839 views

Tags:- Django

Yes, it is possible if the base class is instantiated by other child classes or if the base class is a static method.

Last updated 4 years, 4 months ago | 1839 views

Tags:- Python

The csrf_token is used for protection against Cross-Site Request Forgeries. This kind of attack takes place when a malicious website consists of a link, some JavaScript, or a form whose aim is to perform some …

Last updated 4 years, 4 months ago | 1838 views

Tags:- PHP Django CodeIgniter

Python | Dogpile effect In case the cache expires, what happens when a client hits a website with multiple requests is what we call the dogpile effect. To avoid this, we can use a semaphore lock. When …

Last updated 4 years, 4 months ago | 1836 views

Tags:- Python

Python | Check the memory usage of  an object >>> import sys >>> x = 100 >>> print(sys.getsizeof(x)) 28  

Last updated 4 years, 2 months ago | 1834 views

Tags:- Python

Difference between Python array and Python list Array Lists it is used to store only homogeneous data. The list is used to store heterogeneous data it occupies less amount of memory as the array stores …

Last updated 4 years, 2 months ago | 1826 views

Tags:- Python

Using PDB we debug code in python. Some pdb commands include- <b> — Add breakpoint <c> — Resume execution <s> — Debug step by step <n> — Move to next line <l> — List source code …

Last updated 4 years, 4 months ago | 1826 views

Tags:- Python

Windows | Set path and environment variables in Windows 10 Press the + to access the Power User Task Menu. Now, select the System option. In the About window, click the Advanced system settings link under Related settings from the right side. In the Advanced tab, click the  button. In …

Last updated 4 years, 2 months ago | 1825 views

Tags:- Windows

Python | Main Function In the world of programming languages, the main is considered as an entry point of execution for a program. But in python, it is known that the interpreter serially interprets the file …

Last updated 4 years, 4 months ago | 1825 views

Tags:- Python

Django | Difference between a project and an app The project covers the entire application, while an app is a module or application within the project that deals with one dedicated requirement. So, a project consists …

Last updated 4 years, 4 months ago | 1822 views

Tags:- Django

We can use the python re module to match the string import re def check(txt): # regex pattern pattern = 'ab{4,8}' if re.search(pattern, txt): print('Match found') else: print('Match not found') check("abcbbbb") # Match not found check("aabbbbbc") # …

Last updated 4 years, 2 months ago | 1820 views

Tags:- Python

Python | strip() Function | Remove whitespaces from a string  To remove the whitespaces and trailing spaces from the string, Python provides a strip([str]) built-in function. This function returns a copy of the string after removing whitespaces …

Last updated 4 years, 4 months ago | 1819 views

Tags:- Python

Django | Model  A model is a Python class in Django that is derived from the django.db.models.Model class. A model is used in Django to represent a table in a database. It is used to interact …

Last updated 4 years, 4 months ago | 1819 views

Tags:- Django

It means that a function can be treated just like an object. You can assign them to variables and pass them as arguments to other functions. You can even return them from another function.  You …

Last updated 4 years, 4 months ago | 1818 views

Tags:- Python

Python | Pass Statement The pass statement is used as a placeholder for future code. It represents a null operation in Python. It is generally used for the purpose of filling up empty blocks of …

Last updated 4 years, 4 months ago | 1818 views

Tags:- Python