initial upload
This commit is contained in:
parent
e712ae42b5
commit
38824b6cfe
|
|
@ -1,3 +1,7 @@
|
|||
input.css
|
||||
tailwind.config.js
|
||||
|
||||
|
||||
# ---> Python
|
||||
# Byte-compiled / optimized / DLL files
|
||||
__pycache__/
|
||||
|
|
|
|||
|
|
@ -0,0 +1,119 @@
|
|||
import tarfile
|
||||
# import os.path
|
||||
import os
|
||||
import datetime
|
||||
import shutil
|
||||
from pathlib import Path
|
||||
|
||||
# TODO:
|
||||
|
||||
|
||||
from homepage.settings import BASE_DIR
|
||||
|
||||
|
||||
# TARGET can be 'qs' or 'prod'
|
||||
TARGET = 'prod'
|
||||
SOFTWARENAME = str(Path(__file__).resolve().parent).split('/')[-1]
|
||||
|
||||
PATH_ADD_FILES = f'/home/tobidot/production/{SOFTWARENAME}/{TARGET}'
|
||||
|
||||
EXCLUDES = [
|
||||
('file', '/db.sqlite3'),
|
||||
('file', '/deployment.py'),
|
||||
('file', '/readme.md'),
|
||||
('file', '/settings.py'),
|
||||
('file', '/css_input.css'),
|
||||
('file', '/tailwind.config.js'),
|
||||
('file', '.pkl'),
|
||||
('file', '.del'),
|
||||
('file', '.bckp'),
|
||||
('file', '.po'),
|
||||
('dict', '/__pycache__'),
|
||||
]
|
||||
|
||||
DAILYREVISION = None
|
||||
|
||||
|
||||
def manipulate_html(tarinfo):
|
||||
''' create a temparary copy and add the DAILYREVISION to the static
|
||||
content in the html templates
|
||||
'''
|
||||
|
||||
with open(f'/{tarinfo.name}', 'r') as f_in:
|
||||
|
||||
# iterate over dirs and try to create the needed foldes.
|
||||
dir_str = f'{str(BASE_DIR)[:-7]}temp_html/'
|
||||
for dir in tarinfo.name[len(str(BASE_DIR)):].split('/')[:-1]:
|
||||
try:
|
||||
os.mkdir(f'{dir_str}{dir}')
|
||||
dir_str += f'{dir}/'
|
||||
except Exception as e:
|
||||
dir_str += f'{dir}/'
|
||||
pass
|
||||
|
||||
# make a copy line by line and add the DAILYREVISION to js and css content
|
||||
with open(f'{str(BASE_DIR)[:-7]}temp_html/{tarinfo.name[len(str(BASE_DIR)):]}', 'a') as f_out:
|
||||
for row in f_in:
|
||||
if '.js\' %}"></script>' in row:
|
||||
f_out.write(row[:row.find('.js\' %}"></script>')] + '-' + DAILYREVISION + '.js\' %}"></script>\n')
|
||||
elif '.css\' %}" rel="stylesheet">' in row:
|
||||
f_out.write(row[:row.find('.css\' %}" rel="stylesheet">')] + '-' + DAILYREVISION + '.css\' %}" rel="stylesheet">\n')
|
||||
else:
|
||||
f_out.write(row)
|
||||
|
||||
def filter_htlm(tarinfo):
|
||||
''' Change file path from temp_folder to correct path insite the archive '''
|
||||
tarinfo.name = f'{SOFTWARENAME}/{tarinfo.name[len(f"{str(BASE_DIR)[:-7]}temp_html"):]}'
|
||||
return tarinfo
|
||||
|
||||
def filter_function(tarinfo):
|
||||
''' Exclude some dirs and files that are not necessary for production.
|
||||
Create temp copies of html files.
|
||||
Rename .js and .css files and add the DAILYREVISION.'''
|
||||
for k, v in EXCLUDES:
|
||||
if k == 'file':
|
||||
if tarinfo.name[-len(v):] == v:
|
||||
return None
|
||||
elif k == 'dict':
|
||||
if v in str(tarinfo.name):
|
||||
return None
|
||||
|
||||
# to force the clients to load the newest content
|
||||
if '/templates/' in tarinfo.name and tarinfo.name[-5:] == '.html':
|
||||
# create a temparary copy and add the DAILYREVISION to the static
|
||||
# content in the html templates
|
||||
manipulate_html(tarinfo)
|
||||
return None
|
||||
# elif tarinfo.name[-3:] == '.js':
|
||||
# tarinfo.name = f'{SOFTWARENAME}/{tarinfo.name[len(str(BASE_DIR)):-3]}-{DAILYREVISION}.js'
|
||||
# elif tarinfo.name[-4:] == '.css':
|
||||
# tarinfo.name = f'{SOFTWARENAME}/{tarinfo.name[len(str(BASE_DIR)):-4]}-{DAILYREVISION}.css'
|
||||
|
||||
else:
|
||||
tarinfo.name = f'{SOFTWARENAME}/{tarinfo.name[len(str(BASE_DIR)):]}'
|
||||
|
||||
return tarinfo
|
||||
|
||||
def filter_add(tarinfo):
|
||||
''' Change file path from temp_folder to correct path insite the archive '''
|
||||
tarinfo.name = f'{SOFTWARENAME}/{tarinfo.name[len(str(PATH_ADD_FILES)):]}'
|
||||
return tarinfo
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
# quit()
|
||||
|
||||
|
||||
DAILYREVISION = datetime.datetime.now().strftime(f"%Y%m%d%H%M")
|
||||
|
||||
# Delete Temp_Folder for html files
|
||||
os.mkdir(f'{str(BASE_DIR)[:-7]}temp_html')
|
||||
|
||||
tar = tarfile.open(f"/home/tobidot/production/{SOFTWARENAME}/{DAILYREVISION}-{SOFTWARENAME}-{TARGET}.tar.gz", "w:gz")
|
||||
tar.add(BASE_DIR, recursive = True, filter = filter_function)
|
||||
tar.add(PATH_ADD_FILES, recursive = True, filter = filter_add)
|
||||
tar.add(f'{str(BASE_DIR)[:-7]}temp_html', recursive = True, filter = filter_htlm)
|
||||
tar.close()
|
||||
|
||||
# Delete Temp_Folder
|
||||
shutil.rmtree(f'{str(BASE_DIR)[:-7]}temp_html')
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
from django.contrib import admin
|
||||
|
||||
# Register your models here.
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class HomeConfig(AppConfig):
|
||||
default_auto_field = 'django.db.models.BigAutoField'
|
||||
name = 'home'
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
from django import forms
|
||||
|
||||
class ContactForm(forms.Form):
|
||||
name = forms.CharField(label='Your name', max_length=100)
|
||||
email = forms.EmailField()
|
||||
message = forms.CharField(widget=forms.Textarea)
|
||||
cc_myself = forms.BooleanField(required=False)
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
from django.db import models
|
||||
|
||||
# Create your models here.
|
||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -0,0 +1,93 @@
|
|||
Copyright (c) 2022, Rune Bjørnerås (https://github.com/rubjo)
|
||||
|
||||
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
||||
This license is copied below, and is also available with a FAQ at:
|
||||
http://scripts.sil.org/OFL
|
||||
|
||||
|
||||
-----------------------------------------------------------
|
||||
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
||||
-----------------------------------------------------------
|
||||
|
||||
PREAMBLE
|
||||
The goals of the Open Font License (OFL) are to stimulate worldwide
|
||||
development of collaborative font projects, to support the font creation
|
||||
efforts of academic and linguistic communities, and to provide a free and
|
||||
open framework in which fonts may be shared and improved in partnership
|
||||
with others.
|
||||
|
||||
The OFL allows the licensed fonts to be used, studied, modified and
|
||||
redistributed freely as long as they are not sold by themselves. The
|
||||
fonts, including any derivative works, can be bundled, embedded,
|
||||
redistributed and/or sold with any software provided that any reserved
|
||||
names are not used by derivative works. The fonts and derivatives,
|
||||
however, cannot be released under any other type of license. The
|
||||
requirement for fonts to remain under this license does not apply
|
||||
to any document created using the fonts or their derivatives.
|
||||
|
||||
DEFINITIONS
|
||||
"Font Software" refers to the set of files released by the Copyright
|
||||
Holder(s) under this license and clearly marked as such. This may
|
||||
include source files, build scripts and documentation.
|
||||
|
||||
"Reserved Font Name" refers to any names specified as such after the
|
||||
copyright statement(s).
|
||||
|
||||
"Original Version" refers to the collection of Font Software components as
|
||||
distributed by the Copyright Holder(s).
|
||||
|
||||
"Modified Version" refers to any derivative made by adding to, deleting,
|
||||
or substituting -- in part or in whole -- any of the components of the
|
||||
Original Version, by changing formats or by porting the Font Software to a
|
||||
new environment.
|
||||
|
||||
"Author" refers to any designer, engineer, programmer, technical
|
||||
writer or other person who contributed to the Font Software.
|
||||
|
||||
PERMISSION & CONDITIONS
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
||||
redistribute, and sell modified and unmodified copies of the Font
|
||||
Software, subject to the following conditions:
|
||||
|
||||
1) Neither the Font Software nor any of its individual components,
|
||||
in Original or Modified Versions, may be sold by itself.
|
||||
|
||||
2) Original or Modified Versions of the Font Software may be bundled,
|
||||
redistributed and/or sold with any software, provided that each copy
|
||||
contains the above copyright notice and this license. These can be
|
||||
included either as stand-alone text files, human-readable headers or
|
||||
in the appropriate machine-readable metadata fields within text or
|
||||
binary files as long as those fields can be easily viewed by the user.
|
||||
|
||||
3) No Modified Version of the Font Software may use the Reserved Font
|
||||
Name(s) unless explicit written permission is granted by the corresponding
|
||||
Copyright Holder. This restriction only applies to the primary font name as
|
||||
presented to the users.
|
||||
|
||||
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
||||
Software shall not be used to promote, endorse or advertise any
|
||||
Modified Version, except to acknowledge the contribution(s) of the
|
||||
Copyright Holder(s) and the Author(s) or with their explicit written
|
||||
permission.
|
||||
|
||||
5) The Font Software, modified or unmodified, in part or in whole,
|
||||
must be distributed entirely under this license, and must not be
|
||||
distributed under any other license. The requirement for fonts to
|
||||
remain under this license does not apply to any document created
|
||||
using the Font Software.
|
||||
|
||||
TERMINATION
|
||||
This license becomes null and void if any of the above conditions are
|
||||
not met.
|
||||
|
||||
DISCLAIMER
|
||||
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
||||
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
||||
OTHER DEALINGS IN THE FONT SOFTWARE.
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue