Skip to content

Instantly share code, notes, and snippets.

Avatar
♥️
Focusing

Ankit Chaudhary ankit11421

♥️
Focusing
View GitHub Profile
View Server starting code
const express = require("express");
const bodyParser = require("body-parser");
const ejs = require("ejs");
const mongoose = require("mongoose");
const app = express();
app.set("view engine", "ejs");
app.use(bodyParser.urlencoded({extended: true}));
app.use(express.static("public"));
View Static_files
Paste this at the bottom of settings.py file
STATIC_URL = '/static/'
STATICFILES_DIRS = [
os.path.join(BASE_DIR, "static_my_proj"),
]
STATIC_ROOT = os.path.join(os.path.dirname(
View OTP
<form action="" method='post'>
{% csrf_token %}
<p><label for="id_phone">Phone:</label> <input type="number" name="phone" required id="id_phone"></p>
<span id='msg'></span>
<br>
<p><label for="id_otp">Otp:</label> <input type="number" name="otp" required id="id_otp"></p>
View DJango Slugify
import string
from django.utils.text import slugify
def random_string_generator(size=10, chars=string.ascii_lowercase + string.digits):
return ''.join(random.choice(chars) for _ in range(size))
def unique_slug_generator(instance, new_slug=None):
View SocialAuth
1. pip install social-auth-app-django
2.
Add the social_django to your INSTALLED_APPS
3.
python manage.py migrate