Archived
1
0

Create base django app structure

This commit is contained in:
2020-10-07 10:51:49 +02:00
parent baa9d67d18
commit 4edbcf6f04
12 changed files with 96 additions and 8 deletions

3
.gitignore vendored
View File

@@ -11,3 +11,6 @@ __pycache__/
# Django Database
db.sqlite3
# Django Static Files
.stat/

View File

@@ -1,3 +0,0 @@
from django.contrib import admin
# Register your models here.

View File

@@ -1,3 +0,0 @@
from django.db import models
# Create your models here.

View File

@@ -0,0 +1,9 @@
{% extends "master.html" %}
{% load static %}
{% block title %}Urban Brothers - Home{% endblock %}
{% block content %}
<h1>Urban Brothers</h1>
{% endblock %}

View File

@@ -0,0 +1,8 @@
"""ub URL Configuration
"""
from django.urls import path
from . import views
urlpatterns = [
path('', views.home, name='home')
]

View File

@@ -1,3 +1,5 @@
from django.shortcuts import render
# Create your views here.
def home(request):
return render(request, 'home/index.html')

View File

View File

@@ -0,0 +1,44 @@
{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Title of the HTML page -->
<title>{% block title %}{% endblock %}</title>
<!-- Viewport for a pleasant mobile experience -->
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Charset for compatability and stability -->
<meta charset="utf-8">
<!-- Description for right SE indexing -->
<meta name="Description" content="Homepage of the Urban Brothers.">
<!-- SE indexing -->
<meta name="robots" content="noindex, nofollow" />
<!-- Icons for Materialize CSS -->
<link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/icon?family=Material+Icons&display=swap">
<!-- Load the default master.css for some values -->
<link rel="stylesheet" type="text/css" href="{% static 'css/master.css' %}">
<!-- Add the favicon to the page -->
<link rel="shortcut icon" type="image/x-icon" href="{% static 'pic/urban.ico' %}">
<!-- Compiled and minified CSS for Materialize CSS -->
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
<!-- JQuery for easier HTML manipulation -->
<script type="text/javascript" src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
<!-- Compiled and minified JavaScript for Materialize CSS -->
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
<!-- For custom header elements -->
{% block header %}{% endblock %}
</head>
<body>
<div class="container">
{% block content %}
{% endblock %}
</div>
{% block scripts_below %}{% endblock %}
{% if toast %}
<script type="text/javascript">M.toast({html: '{{ toast }}', classes: 'rounded'});</script>
{% endif %}
</body>
</html>

5
src/steam_tools/apps.py Normal file
View File

@@ -0,0 +1,5 @@
from django.apps import AppConfig
class SteamToolsConfig(AppConfig):
name = 'steam_tools'

6
src/steam_tools/urls.py Normal file
View File

@@ -0,0 +1,6 @@
from django.urls import path
from . import views
urlpatterns = [
path('swf', views.steam_with_friends, name='steam_with_friends')
]

6
src/steam_tools/views.py Normal file
View File

@@ -0,0 +1,6 @@
from django.shortcuts import render
def steam_with_friends(request):
context = {}
return render(request, 'steam_tools/swf.html', context)

View File

@@ -24,6 +24,7 @@ ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
'home',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
@@ -47,7 +48,9 @@ ROOT_URLCONF = 'ub.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'DIRS': [
BASE_DIR / 'shared/templates'
],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
@@ -104,9 +107,17 @@ USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.1/howto/static-files/
STATIC_ROOT = os.path.join(BASE_DIR, 'stat/')
STATIC_URL = '/static/'
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'shared/ressources')
]
# Media paths for serving uploaded files
MEDIA_ROOT = os.path.join(BASE_DIR, 'media/')
MEDIA_URL = '/media/'
LOGIN_URL = '/login'
# Maximum File Size for File Uploads
FILE_UPLOAD_MAX_MEMORY_SIZE = 104857600
DATA_UPLOAD_MAX_MEMORY_SIZE = 104857600