$ docker
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.utils.deprecation import MiddlewareMixin | |
from django.utils.timezone import now | |
from jobsapp.metrics import requests_total, last_user_activity_time | |
class CustomMiddleware(MiddlewareMixin): | |
def __init__(self, get_response): | |
self.get_response = get_response |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ssh into the server and goto the directory | |
then create a folder using mkdir, cd into that folder. create virtualenv and activate that env | |
clone project using git and goto the project directory. install dependencies using pip install -r requirements.txt. | |
create service file sudo nano /etc/systemd/system/<name>.service and configure like below: | |
[Unit] | |
Description=gunicorn daemon for listen music project |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let forms = document.querySelectorAll('[aria-label="Follow this person"]'); | |
for(var i = 0; i < forms.length; i++) { | |
forms[i].click(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"version":1,"resource":"file:///home/rumi/Desktop/projects/nodejs/webrtc/frontend/src/components/shared/Card/Card.module.css","entries":[{"id":"lC2W.css","timestamp":1664637792376}]} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from twilio.rest import Client | |
from django.conf import settings | |
from django.http import HttpResponse | |
def send_sms(request): | |
message = 'Add Your Message Here' | |
from = 'Your Twilio Number Here' | |
to = 'Reciever Phone Number' | |
client = Client(settings.TWILIO_ACCOUNT_SID, settings.TWILIO_AUTH_TOKEN) | |
response = client.messages.create(body=message, to=to, from_=from_) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM php:7.2.10-apache-stretch | |
RUN apt-get update -yqq && \ | |
apt-get install -y apt-utils zip unzip && \ | |
apt-get install -y nano && \ | |
apt-get install -y libzip-dev libpq-dev && \ | |
a2enmod rewrite && \ | |
docker-php-ext-install pdo_pgsql && \ | |
docker-php-ext-install pgsql && \ | |
docker-php-ext-configure zip --with-libzip && \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def format_code(code_name): | |
"""Format django error code to Circle Error code""" | |
if code_name == 'blank': | |
return "BLANK_FIELD" | |
elif code_name == 'invalid': | |
return "INVALID_DATA" | |
elif code_name == 'required': | |
return "KEY_ERROR" | |
else: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.urls import path | |
from . import views | |
app_name = 'accounts' | |
urlpatterns = [ | |
path('login', views.Login.as_view(), name='login'), | |
path('register', views.Register.as_view(), name='register'), | |
path('logout', views.LogoutView.as_view(), name='logout'), |
NewerOlder