Posts

Showing posts with the label Django Models

Let's go Django

Image
Django File (and Image) Uploads Tutorial This tutorial shows how to implement file and then image uploading with Django. We’ll build a basic Instagram clone. Setup If you’re on a Mac the  Desktop  is a convenient place to put our code. The location doesn’t matter; it just needs to be easily available. On the command line, navigate there and create a directory  insta  for our files. We will use  Pipenv  to install both Django and  pillow  which is a Python image process library Django relies on for image files. For non-image file uploads  pillow  is not needed. Finally activate our new virtual environment with the  shell  command. $ cd ~/Desktop $ mkdir insta && cd insta $ pipenv install django==2.1.5 pillow==5.4.1 $ pipenv shell (insta) $ You should see  (insta)  going forward to indicate we’re in an active virtual environment. You can type  exit  at any time to leave it and  ...

Complete Django Project

Image
In this tutorial we’ll learn how to properly start a new Django project with a custom user model and add Gmail social authentication via  django-allauth . I I believe these features are  must haves  in any new Django project in 2018. A custom user model is  highly recommended  in the official docs and allows for future customization. Adding social authentication via third-party services like Gmail, Facebook, and other services is also common. By using  django-allauth  from the beginning, we can add social auth as needed. I want to express my appreciation upfront to the work of Raymond Penners on  django-allauth  as well as the open-source  cookiecutter-django  and  demo-allauth-bootstrap  projects. The outline of our work is as follows: start a basic Django project add a pages app for the homepage implement a custom user model signup, login, logout install django-allauth get Google credentials update t...