Skip to content

Instantly share code, notes, and snippets.

View Sebuliba-Adrian's full-sized avatar
🏡
Working remotely

Sebuliba Adrian Sebuliba-Adrian

🏡
Working remotely
View GitHub Profile
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'postgres',
'USER': 'postgres',
'PASSWORD': 'password',
'HOST': 'db',
'PORT': 5432
}
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
from django.urls import path
from .views import index
urlpatterns = [
 path('', index, name='index')
]
from django.http import HttpResponse
def index(request):
  return HttpResponse('Welcome to the Django!')
from django.contrib import admin
 from django.urls import path, include 
urlpatterns = [
 path('admin/', admin.site.urls),
path('', include('shop_app.urls')), 
]
@Sebuliba-Adrian
Sebuliba-Adrian / setting.py
Created March 3, 2021 05:52
settings file
INSTALLED_APPS = [ 
'django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions', 
'django.contrib.messages', 
'django.contrib.staticfiles', 
'shop_app.apps.ShopAppConfig', 
]
FROM python:3.9
# Set environment variables
#Use familiar console instead of docker one
ENV PYTHONDONTWRITEBYTECODE 1
#Avoid .pyc file from getting created by python in the image
ENV PYTHONUNBUFFERED 1
# Declare src as work directory in the docker file system
WORKDIR /src
# Copy dependencies file to the docker file system of which src is part
COPY requirements.txt /src/
version: '3.7'
services:
web:
build: .
command: python /src/manage.py runserver 0.0.0.0:8000
volumes:
- .:/src
ports:
- 8000:8000
<?php
namespace App\Http\Middleware;
use Closure;
use Exception;
use App\Models\User;
use Firebase\JWT\JWT;
use Firebase\JWT\ExpiredException;
class JwtMiddleware
<?php
/**
* Created by PhpStorm.
* User: adrian
* Date: 22/07/2018
* Time: 16:40
*/
namespace App\Http\Controllers;