Django

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

Categories: Django, Django-Encrypt-File, documentation, technical-blogs

Docker: Use Celery in Django(Redis as Broker)

In previous two posts, we have deployed Django with Postgres, Nginx, now its time to do some async stuff using Celery. In this post, I will do the magic tricks first, explain them later. Add Celery to Django To add celery, we need make a container for celery. We can re-use the Dockerfile of django for making celery's container like this: FROM python:latest ENV PYTHONUNBUFFERED 1 #ENV C_FORCE_ROOT true # intentionally kept it commented ENV APP_USER user ENV APP_ROOT /src RUN groupadd -r ${APP_USER} \ &…

Keep reading

Categories: Django, Docker, Celery, technical-blogs

Serve Static Files by Nginx from Django using Docker

This is more of a follow up post of my previous blog. Before I start, I am assuming you have successfully deployed django using docker & nginx, but having some problems serving static files. No worries, its easy. Just follow these steps: 1. In your django settings.py file, add static file directory i.e. STATIC_ROOT=/static. So what it will do is, when you run collectstatic command(python manage.py collectstatic), it will store the static files in your /static directory of OS. 2. Now in docker-compose.yml…

Keep reading

Categories: Django, Docker, Nginx, technical-blogs

Deploy Django, Gunicorn, NGINX, Postgresql using Docker

This post mainly based on this blog: https://docs.docker.com/compose/django/. I will be extending this post by serving django+gunicorn using Nginx, also I will using Postgresql docker container to use it as database. Lets not waste time and go to the following steps. 1. Let's make an empty directory named myproject and add another folder inside name it src. src should contain the django project. For testing purpose lets put a simple django project inside named mydjango. 2. Let's create a subdirectory inside myproject and name…

Keep reading

Categories: Django, Gunicorn, Nginx, Postgres, Docker, technical-blogs

Django 1.7 + Scrapy

Today I am going to share how to use Scrapy and Django together to crawl to a website and store scraped data to Database using Django. First, let us build a Django application using the following commands. pip install django==1.7 django-admin.py startproject example_project cd example_project Inside the example_project directory, we will create a django app named app: python manage.py startapp app Then, we will update the models.py like this: from django.db import models class ExampleDotCom(models.Model): title = models.CharField(max_…

Keep reading

Categories: Django, Scrapy, technical-blogs