Skip to main content

Posts

Showing posts with the label Django

django react app setting up the backend

On the previous article I demonstrated how we can use the generic views along with ModelSerializer classes to rapidly develop our REST APIs. Knowledge that you will need  in your career as full stack / backend developer, however think of this article as an extension to the previous one, equipped with what we already know about REST API we will step our game up and discuss about ViewSet, ModelViewset we will dig deep into the concepts of Routers which allow us to manage our api routes in a simple and sophisticated manner as well as helping to speed up building APIs even further. There for on part II of this article i'll work you through on how React application can consume this RESTful API. There for at the end of the day we will have a full stack web app, in short we strat our development at the backend then later on we move at the frontend... so are you excited and ready to take the challange? lets do this then..... you can get source code for the bakend on github Preparat...

How to create REST API using Django REST Framework

This post begins with already working project and app's, I found that there some few requirement's that my project needed to handle and the best option for those requirement's was to use the Django's  Rest Framework. The way that I will tackle this task is more specific to the needs of the project rather than a one to one how to..., that being said you can still follow along, the approach that I'm going to use is easy to follow since I'll be providing a lot of information a log the way for better understanding of the why and how.....this code is available on Github , enough with the alerts and on with the show. Note:  If you would want to mimic the exactly settings then you will need to enable user authentication on your project you can follow this link for details .  Start with the DRF (Django Rest Framework) installation pip3 install djangorestframework For our app to use DRF, we'll have to add rest_framework into our settings.py.   nan...

Publishing your Django project to github

On this post I will work you through the process of  deploying you app! to the  external service we'll be using  GitHub which is a code hosting service. Deploying is the process of publishing your application on the Internet so people can finally go and see your app. :) Git is a very popular "version control system" used by a lot of programmers. This software can track changes to files over time so that you can recall specific versions later. A bit like the "track changes" feature in word processor programs (e.g., Microsoft Word or LibreOffice Writer), but much more powerful.   Installing Git: Debian  apt install git Git tracks changes to a particular set of files in what's called a code repository (or "repo" for short). Let's start one for our project. Open up your console and run these commands, to make sure your on the project-level directory. find out your current working directory pwd        #find o...

django user authentication how to login, logout and Register

This post will demonstrate the necessary step's that you will need to follow when you want to build  authentication system with you Django framework using the built-in user authentication system . You can get the code of this project on github Start with clean work space where Django app is going to live  mkdir news-wire cd news-wire Time to setup virtual eviroment, install django and kickoff the project python3 -m venv venv source venv/bin/activate pip3 install Django django-admin startproject news_art House keeping mv news_art/manage.py ./ mv news_art/news_art/* news_art/ rm -r news_art/news_art/ nano news_art/settings.py ALLOWED_HOSTS = [ '*' ] ---------- We want to acsses our app from anywhere Django automatically installs the auth app when a new project is created. This can be reveled in the settings.py under INSTALLED_APPS and you can see auth is one of several built-in apps Django has installed. INSTALLED_APPS = [   ...

How to Install PostgreSQL on debian stretch in oder to use it with your Django application and allow remote connection

In this guide, we'll demonstrate how to install and configure PostgreSQL to use with your Django applications. We will install the necessary software, create database credentials for our application, and then start and configure a Django project to use this backend. We will start by  install the database software and the associated libraries required to interact with them. This guide assumes that you allready have a working Django project. Step 1 – Prerequsities apt-get install python3-pip python3-dev libpq-dev postgresql postgresql-contrib Step 2 – Connect to PostgreSQL After installing the PostgreSQL database server by default, it creates a user ‘postgres’ with role ‘postgres’. It also creates a system account with the same name ‘postgres’. So to connect to postgres server, login to your system as user postgres and connect database. su - postgres You should now be in a shell session for the postgres user. Log into a Postgres session by typing:...