Django

Boilerplate: Django with AngularJs 1.X(Powered By Webpack2, Yarn, Docker, DRF, ES6)

Django with AngularJs is a popular combo. In this boilerplate, I tried to provide a foundation for using Django and AngularJs 1.X together. Here AngularJs Application has been built using ES6. Docker also comes with Postgres, NGINX etc. Source Code is available here: https://github.com/ruddra/django-angular-boilerplate. Tech Stack Python3 Django 1.11.6, Django Rest Framework Webpack 2 JavaScript(ES6)/AngularJS 1.x Yarn Prerequisite Require Yarn. How to install Yarn: https://yarnpkg.com/lang/en/docs/install/ Require Docker if you want to use this boilerplate…

Keep reading

Using VS Code for Python/Django Development

VS Code is an editor developed by Microsoft. I have been using this editor for Python development for a few months now. Previously I have been using Pycharm Community Edition for development, but I had to switch to an editor which was less resource consuming than Pycharm, hence I found VS Code. It was initially suggested to my by one of my colleagues. My first impression was, what is this? Is it really usable? Is it as bad as Atom?(I have a dreadful experience with Atom, although Atom is…

Keep reading

Play With Pillow

Who hasn't heard PIL? It's an image processing library made by python (Python Image Library). Pillow is an extension of it. So installing pillow is really easy: pip install pillow Now we are going to do some image processing cool stuff: First Load Image: from PIL import Image, ImageOps img = Image.open('image.png') Resize Image Suppose We want to resize an image and maintain its aspect ratio. Here we need to get the aspect ratio after resizing. Here is a snippet for it: def get_resize_image_size(image,…

Keep reading

Python: Selenium with PhantomJs to capture Screenshots

PhantomJS is a headless WebKit scriptable with a JavaScript API. It has fast and native support for various web standards: DOM handling, CSS selector, JSON, Canvas, and SVG. And Selenium is A portable software-testing framework for web applications. Selenium provides a record/playback tool for authoring tests without the need to learn a test scripting language (Selenium IDE) Using the combination of selenium and PhantomJs can give you a way to capture screenshots and use it in your choices. For that let's install PhantomJs in your computer. For Ubuntu/Debian…

Keep reading

Documentation Of Django Encrypt File

Django Encrypt File is a simple Library which can be used to encrypt uploaded files and store them. Installation Use pip to install it: pip install djangoencryptfile Or pip install https://github.com/ruddra/django-encrypt-file/tarball/0.7 Basic Usage from djangoencryptfile import EncryptionService from django.core.files import File password = '1234' service = EncryptionService(raise_exception=False) open('readme.md', 'rb') as inputfile: usefile = File(inputfile, name='readme.md') encrypted_file = service.encrypt_file(useFile, password, extension='enc') # it will save readme.md.enc decrypt_file = service.decrypt_file(encrypted_…

Keep reading