Social Networking Website in Django (Cloudinary + Sendgrid)

@gpthree Image by @gpthree on Unsplash

Did you know that almost every person on our planet is a user of at least five types of social networking sites? Facebook alone, the most popular social network website, has 2.375 billion users. That is why developing a social network website often comes to the minds of entrepreneurs when they look at these astounding numbers.

Building and managing your own social networking website comes to many when they are fed up with those bunch of features and content, which they may don’t even want to use, making the platform over populated with posts not relevant to them.

A simple example explaning this, is Instagram. After the initial public launch, it was mainly designed for artists for sharing photos. Then IGTV Videos were introduced, followed by Direct Messaging. Now, they have introduced Reels, which brings all features of TikTok and similar apps (as TikTok is banned in India and some other countries). This leaves the platform much similar to Facebook.

This is a detailed tutorial explaining how to build a social networking website from scratch in Django along with Cloudinary CDN integration for storing media files and Sendgrid for crash reporting.

The user can write articles, upload profile picture, display bio in profile, view other user’s profile and their articles.

The full source code of the project can be found in this repo → VellXR

Initialisation

Create a Django project and an app for the same.

Setup virtualenv and install requirements.

Configure project settings

The existing settings.py uses production settings. Create a local_settings.py in same directory to run the project in development mode.

Coding time !

Create your models in VellXR/user/models.py and make cloudinary CDN configurations.

Replace the environment variables with your Cloudinary CLOUD_NAME, API_KEY, API_SECRET.

In VellXR/user/admin.py register your models.

Setup urls for the project.

Building views

Here, views will mainly consist of the following components -

  • index

  • about

  • user_login

  • user_logout

  • register

  • user_profile

  • write

  • profile_posts

  • profile_posts_detail

  • search

Building forms

Forms will be of 3 types -

  • UserForm

  • UserDetailForm

  • PostForm

Configuring Sendgrid

The config is pretty easy and straightforward.

  • ADMIN_FULL_NAME - full name on Sendgrid console

  • ADMIN_EMAIL_ID - E-mail ID used to signup on Sendgrid

  • SENDGRID_API_KEY - Sendgrid API key

  • MAILER_LIST - list of users to send e-mail

  • DEFAULT_FROM_EMAIL - E-mail ID used to signup on Sendgrid

  • EMAIL_HOST_USER - Username on Sendgrid console

  • EMAIL_HOST_PASSWORD - Password of Sendgrid account

Running the app

The app is now ready for development use. Running the following necessary commands will fire up our app for use.

Your thoughts are valuable for me. Express your views and suggestions in comments and give a clap if you like the project.

Avatar
Prakhar Gurunani
🎯 Focusing

Backend and Frontend developer • 🐍 lover • Affection for IOT • Advocating Open Source to people around me

comments powered by Disqus