Skip to main content

Posts

Showing posts with the label URLshortner

Create a URL Shortener app with Python and Django Part-3

In this part... This will be the last part of the Create a URL Shortener app with Python and Django Series and if you have not read the last two parts yet please read them before you read this part.  PART 1 -  https://blogofchamodh.blogspot.com/2022/07/create-url-shortener-app-with-python.html PART 2 -  https://blogofchamodh.blogspot.com/2022/07/create-url-shortener-app-with-python-part2.html we have discussed how to set up our virtual environment and start the project and apps in part 1 and learned the logic and some important views in part 2. So it is vital to read them first. In this part, I will show you how to, Create the URL patterns Writing the template. Write the redirect view Create the URL patterns. To handle the URL requests we can create the URL patterns as shown below. from django . contrib import admin from django . urls import path from url_shortener import views urlpatterns = [     path ( 'admin/' , admin . site . urls ),     ...

Create a URL Shortener app with Python and Django. Part-2

Create a URL Shortener app with Python and Django. Part-2 READ PART 1 :  https://blogofchamodh.blogspot.com/2022/07/create-url-shortener-app-with-python.html READ PART 3:  https://blogofchamodh.blogspot.com/2022/08/create-url-shortener-app-with-python.html Photo by  LinkedIn Sales Solutions  on  Unsplash To start the project you have to use the Django-admin  command. This tutorial series is to teach how to create a URL Shortener app and I don't explain the very basics. Please let me know if you want a primary tutorial series in the comment section below. 1. Starting the project. 2. Starting the app To start a Django app we run the python manage.py [APP_NAME]    command. 2. Register the app To tell Django to consider url_shortener as an app for our project we have to edit the settings.py file inside the Shortener Folder. Add a line in the following format to the INSTALLED_APPS list.   [APP_NAME].apps.[APP_CONFIG_NAME]   To fin...

Create a URL Shortener app with Python and Django Easily. Part-1

Create a URL Shortener app with Django  Part 1. How to set up and activate the virtual environment & installing Django. READ PART 2:   https://blogofchamodh.blogspot.com/2022/07/create-url-shortener-app-with-python-part2.html READ PART 3:  https://blogofchamodh.blogspot.com/2022/08/create-url-shortener-app-with-python.html As promised in the previous post ( How to generate a random string with Python. ), I am starting a post series on creating a URL Shortener app with Django and Python. Photo by LinkedIn Sales Solutions on Unsplash Getting Started INFO: I am using GitBash CLI and if anyone uses it please download and install it following the link below.  https://gitforwindows.org/ First, we have to create a virtual environment so that we can isolate our project. Even if there are too many ways to do it,  I am going to use virtualenv to do it. To create a virtual environment, follow the instructions below. 1. Create a new folder. To make things easier, we ...