108 Commits
Author SHA1 Message Date
marc a6f119b6c0 bye run
Pylint / build (push) Canceled after 0s
2022-01-17 20:45:19 +01:00
marc 735450f4b0 runtest 2022-01-17 20:45:09 +01:00
marc 03a587bec9 kill 2022-01-17 20:42:58 +01:00
marc 41f53d1ae2 nosetup 2022-01-17 20:35:35 +01:00
marc 49d360a942 nosetup 2022-01-17 20:28:45 +01:00
marc 1983e73e14 nosetup 2022-01-17 20:27:37 +01:00
marc d82992c8a1 start pipenv 2022-01-17 20:23:22 +01:00
marc 151a44f366 production false 2022-01-17 20:12:59 +01:00
marc f4c572a8a2 generate .env if it does not exist 2022-01-17 20:12:03 +01:00
marc 351f04c859 pipfile.lock 2022-01-17 19:52:34 +01:00
marc db9ca12b4c headless 2022-01-17 19:46:40 +01:00
marc b3ddaae5f2 phony + make list 2022-01-17 19:36:47 +01:00
marc 2c69c495fc pipenv update 2022-01-17 19:17:36 +01:00
marc defde3ff28 pipenv update 2022-01-17 19:15:10 +01:00
marc 512c19746d commenting entrypoint 2022-01-17 19:15:05 +01:00
marc 2d9af7b785 bye useless log 2022-01-17 19:14:39 +01:00
marc 4c669d624d selenium 2022-01-17 19:14:07 +01:00
marc 32bee56dad Merge branch 'master' into test 2022-01-17 18:57:57 +01:00
marc 80391aa894 pipfile.lock 2022-01-17 18:57:51 +01:00
marc 345312a259 testing homepage 2022-01-17 18:57:27 +01:00
marc 889914403c init setup start entrypoint.sh 2022-01-15 20:19:04 +01:00
marc 12297520da pipeline with make to avoid redundancy 2022-01-15 20:01:30 +01:00
marc 2b57f624c5 bye healhthcheck 2022-01-15 19:52:22 +01:00
marc f8380267df updated cv 2022-01-15 19:18:32 +01:00
marc 451ccd8a7d start period for healthcheck + more silent 2022-01-15 19:13:27 +01:00
marc ff569bee10 bye build and deploy 2022-01-15 19:10:57 +01:00
marc bded141624 bye down 2022-01-15 19:10:28 +01:00
marc 552b5d3afe bye up 2022-01-15 19:09:55 +01:00
marc 2989138fac pipenv update 2022-01-15 19:08:24 +01:00
marc fca1b6dfab no ignore files neither 2022-01-11 13:18:48 +01:00
marc b06cf4b749 no .travis.yml 2022-01-11 13:18:09 +01:00
marc d34ca52c4d no pipfile in docker image 2022-01-11 13:16:44 +01:00
marc 09c83fa203 dockerignore 2022-01-11 12:55:08 +01:00
marc 41ebca2bb9 healthcheck secret key docker-compose 2022-01-11 12:52:18 +01:00
marc bce91cc538 updated dependencies 2022-01-11 03:56:05 +01:00
marc 41f5518faa collectstatict 2022-01-11 03:52:42 +01:00
marc a3baef397b added healthcheck 2021-12-30 13:13:51 +01:00
marc df3c691847 host 2021-12-30 01:42:20 +01:00
marc 5a0a585389 update requirements.txt 2021-12-25 01:16:26 +01:00
marc 82232f74ec labels 2021-12-25 01:14:20 +01:00
marc 52856ca529 using established conventions for makefile 2021-12-22 21:18:56 +01:00
marc 781c8db3d3 updatepip
Pylint / build (push) Canceled after 0s
2021-12-22 03:34:57 +01:00
marc f0a115b1c5 update 2021-12-13 22:01:12 +01:00
marc fd225cd372 Makefile with command dependencies 2021-12-13 22:01:08 +01:00
marc 3a94f97e92 pipfile.lock 2021-12-11 04:15:53 +01:00
marc fadbe2feb9 pipfile.lock 2021-12-10 21:51:37 +01:00
marc 4a6a2cc2bd 127.0.0.1 2021-12-10 02:22:31 +01:00
marc 24ca19756f makefile 2021-12-10 02:16:30 +01:00
marc 3c9a0b8d57 renamed 2021-12-10 02:15:56 +01:00
marc 7b5ed373e2 pipfile.lock 2021-11-29 09:53:26 +01:00
marc b2493a8b1f deploy config 2021-11-29 09:43:43 +01:00
marc 8fafb18fcc pipfile.lock 2021-11-29 02:38:40 +01:00
marc c620ee05f2 new entrypoint 2021-11-29 00:51:01 +01:00
marc f1bc97fb5d stream 2021-11-29 00:03:59 +01:00
marc f02fde398a fix case by case 2021-11-28 23:33:40 +01:00
marc b620f75ccc pipfile.lock 2021-11-28 23:22:59 +01:00
marc a97a622595 update 2021-11-27 13:21:37 +01:00
marc 937c087b1e dev yml that works 2021-11-27 00:28:19 +01:00
marc c92fc99dee new pipfile.lock 2021-11-22 09:33:12 +01:00
marc 10769c634f collectstatic for no reason 2021-11-19 09:57:34 +01:00
marc 8a1579b966 pipfile.lock 2021-11-19 09:40:03 +01:00
marc 9cd2391a21 bye pipfile.lock 2021-11-19 08:31:49 +01:00
marc db9dd94055 new makefile 2021-11-19 08:06:01 +01:00
marc 6e1f752655 bye 500 2021-11-18 19:29:03 +01:00
marc 5ce132a6f2 pipfile.lokc 2021-11-15 14:20:37 +01:00
marc 06755ce98f ppfile.lock 2021-11-15 02:11:41 +01:00
marc cc8ecb3cb2 python 3.7.12 2021-11-15 01:57:29 +01:00
marc 68a7fbde07 better entrypoint.sh 2021-11-15 01:31:32 +01:00
marc 1d89673a92 Update README.md 2021-11-14 21:32:47 +01:00
marc dc4ffff6cb secret key env 2021-11-14 19:59:32 +01:00
marc d9b704b522 pipenv run stuff 2021-11-14 19:51:56 +01:00
marc 311fa257e8 npm and makemigrations 2021-11-14 19:04:53 +01:00
marc bacb20b160 collect static not input pipeline 2021-11-14 18:59:10 +01:00
marc 3ae4d01239 pipfile.lock 2021-11-14 17:31:34 +01:00
marc 54e916c665 Create codeql-analysis.yml 2021-11-14 16:16:53 +01:00
marc c4ff09e93f pipfile.lock 2021-11-14 15:17:47 +01:00
marc e6446c7638 ok 2021-11-14 02:49:19 +01:00
marc 1334e12f74 if this does not work i don t know what will 2021-11-14 02:33:10 +01:00
marc f14b1879cf python3.7 2021-11-13 23:54:51 +01:00
marc 4608d5d304 trying pipfile 2021-11-13 23:33:46 +01:00
marc 752264aac2 trying 3.7.12 2021-11-13 18:40:18 +01:00
marc 72b2039221 3.7 2021-11-13 18:01:42 +01:00
marc b5fe6f2607 github action python3.7 installation 2021-11-13 18:00:04 +01:00
marc f7f978e1d0 ppa 2021-11-13 17:56:31 +01:00
marc c48bef25bd workflow 2021-11-13 17:52:43 +01:00
marc 0eed827580 more restrictive dockerignore 2021-10-25 17:09:50 -04:00
marc c15f6feb47 good docker-compose.dev.yml with default arbitrary logins 2021-10-25 16:46:36 -04:00
marc 04350a89ee entrypoint that works 2021-10-25 16:41:53 -04:00
marc a92b86ac05 settings.py 2021-10-25 16:19:20 -04:00
marc 4ab52902f0 good db settings.py 2021-10-25 15:36:19 -04:00
marc b4a94f2890 database 2021-10-25 15:30:34 -04:00
marc 507fe0c52c responsive settings 2021-10-25 15:29:23 -04:00
marc 7848103e38 healthcheck network env var 2021-10-25 15:12:55 -04:00
marc 8a12afb8ca pipfile 2021-10-25 14:17:22 -04:00
marc bb91932435 updating deployment files 2021-10-25 13:46:57 -04:00
marc ca02f288aa docker-compose.dev.yml 2021-10-25 13:25:09 -04:00
marc 351fd1664b docker-compose.dev.yml 2021-10-25 19:03:35 +02:00
marc 22db838497 entrypoint.sh without makemigrations and with createsuperuser 2021-10-25 18:23:04 +02:00
marc 55980d9286 brew start and stop 2021-10-25 18:12:26 +02:00
marc 2c95c2d582 migrating ip address field 2021-10-25 18:10:31 +02:00
marc 6333cea237 make brew 2021-10-25 18:07:58 +02:00
marc ddd51b468e pipfile.lock 2021-10-25 18:05:42 +02:00
marc c442790e2c pipfile.lock 2021-09-29 17:05:44 +02:00
marc a4ab372b4b pipfile.lock update 2021-09-29 14:50:35 +02:00
marc 891ad298f3 updated pipfile.lock 2021-08-22 18:20:30 +02:00
marc e19d37fbc6 adding notifications support 2021-08-18 17:59:41 +02:00
marc b2d785c4be pipfile.lock 2021-08-18 17:50:25 +02:00
marc 281c1bf8f1 pipfile.lock 2021-08-16 22:40:58 +02:00
30 changed files with 1843 additions and 1089 deletions
+15
View File
@@ -1,7 +1,22 @@
Dockerfile
Procfile
run.sh
runtime.txt
Makefile
heroku.yml
docker-compose.yml
dev.yml
db.sqlite3
venv
.env
.github/
.git
.vim/
.buildpacks
*.pem
*.crt
Pipfile
Pipfile.lock
.travis.yml
.gitignore
.dockerignore
+70
View File
@@ -0,0 +1,70 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"
on:
push:
branches: [ master ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
schedule:
- cron: '45 22 * * 4'
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [ 'javascript', 'python' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://git.io/codeql-language-support
steps:
- name: Checkout repository
uses: actions/checkout@v2
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1
# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
#- run: |
# make bootstrap
# make release
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
-18
View File
@@ -1,18 +0,0 @@
name: Docker Image CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build the Docker image
run: docker build . --file Dockerfile --tag marcpartensky/website:$(date +%s)
-76
View File
@@ -1,76 +0,0 @@
name: Docker
on:
push:
# Publish `master` as Docker `latest` image.
branches:
- master
# Publish `v1.2.3` tags as releases.
tags:
- v*
# Run tests for any PRs.
pull_request:
env:
# TODO: Change variable to your image's name.
IMAGE_NAME: marcpartensky/website
jobs:
# Run tests.
# See also https://docs.docker.com/docker-hub/builds/automated-testing/
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run tests
run: |
if [ -f docker-compose.test.yml ]; then
docker-compose --file docker-compose.test.yml build
docker-compose --file docker-compose.test.yml run sut
else
docker build . --file Dockerfile
fi
# Push image to GitHub Packages.
# See also https://docs.docker.com/docker-hub/builds/
push:
# Ensure test job passes before pushing image.
needs: test
runs-on: ubuntu-latest
if: github.event_name == 'push'
steps:
- uses: actions/checkout@v2
- name: Build image
run: docker build . --file Dockerfile --tag $IMAGE_NAME
- name: Log into registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin
- name: Push image
run: |
IMAGE_ID=docker.pkg.github.com/${{ github.repository }}/$IMAGE_NAME
# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Strip "v" prefix from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
# Use Docker `latest` tag convention
[ "$VERSION" == "master" ] && VERSION=latest
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION
+49
View File
@@ -0,0 +1,49 @@
name: Docker
on:
push:
branches:
- master
# Publish `v1.2.3` tags as releases.
tags:
- v*
# Run tests for any PRs.
pull_request:
env:
IMAGE_NAME: website
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Update apt
run: sudo apt update && sudo apt upgrade -y && sudo apt autoremove -y
- name: Install make
run: sudo apt install make -y
- name: Install Python3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
architecture: x64
- name: make init
run: make init
- name: make update
run: make update
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
push: true
tags: marcpartensky/website:latest
-36
View File
@@ -1,36 +0,0 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Python application
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest
+3
View File
@@ -49,3 +49,6 @@ nohup.out
# Staticfiles
staticfiles
# selenium
geckodriver.log
+18 -17
View File
@@ -1,11 +1,19 @@
FROM python:3.7.7
FROM python:3.7.12
# ARG timestamp
# ARG commit
LABEL maintainer="marc.partensky@gmail.com"
LABEL image="https://hub.docker.com/r/marcpartensky/website"
LABEL source="https://github.com/marcpartensky/website"
LABEL link="https://marcpartensky.com"
# LABEL build.timestamp=timestamp
# LABEL build.commit=commit
COPY . /app
WORKDIR /app
RUN apt-get update
RUN curl -fsSL https://deb.nodesource.com/setup_15.x | bash
RUN curl -fsSL https://deb.nodesource.com/setup_16.x | bash
RUN apt-get install -y nodejs
RUN npm install -g npm@latest
RUN npm install
@@ -17,23 +25,16 @@ ENV PYTHONUNBUFFERED 1
RUN pip install -U pip
RUN pip install -r requirements.txt
# Needed to collectstatic
ENV SECRET_KEY secret
RUN ./manage.py collectstatic --noinput
RUN ./run.sh
ENV PORT 80
HEALTHCHECK --interval=5s \
--timeout=5s \
CMD curl -f http://127.0.0.1:$PORT || exit 1
# EXPOSE 443
ENV HOST 0.0.0.0
EXPOSE 80
# EXPOSE 443
ENTRYPOINT run.sh
HEALTHCHECK --interval=30s \
--timeout=10s \
--start-period=1m \
--retries=3 \
CMD curl -sSf http://127.0.0.1:$PORT/live || exit 1
ENTRYPOINT ["/app/entrypoint.sh"]
# ENTRYPOINT ["daphne", "-e", "ssl:443:privateKey=$KEY:certKey=$CERT", "django_project.asgi:application"]
# ENTRYPOINT ["daphne", "django_project.asgi:application", "--port", "80", "--bind", "website", "-v2"]
+62 -27
View File
@@ -1,32 +1,67 @@
init:
pip install pipenv
# HOST := localhost
# PORT := 8000
PRODUCTION := false
.PHONY: start list build push setup update init test up down migrate brewstart brewstop dev prod clean deploy
start:
pipenv run ./entrypoint.sh --nosetup
list:
@LC_ALL=C $(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | egrep -v -e '^[^[:alnum:]]' -e '^$@$$'
build: update
docker-compose -f dev.yml build website
push: build
git pushall
docker-compose -f dev.yml push website
setup: init update start
update:
npm update
npm audit fix || echo npm audit fix failed
# pipenv lock --pre --clear
pipenv update
pipenv lock -r > requirements.txt
SECRET_KEY=secret pipenv run ./manage.py collectstatic --noinput
SECRET_KEY=secret pipenv run ./manage.py makemigrations
init: .env
pip install --user pipenv
pipenv install --dev
npm install --save
update:
pipenv lock --pre --clear
npm update
activate:
pipenv shell
deactivate:
exit
build:
docker build . -t marcpartensky/website
push:
docker push marcpartensky/website
git pushall
up:
test:
pipenv run ./manage.py test
runtest:
make start &
make test
make kill
kill:
pipenv run ./entrypoint.sh kill
up: init
docker-compose up -d
down:
docker-compose down
run:
pipenv run ./manage.py runserver 0.0.0.0:8000
migrations:
pipenv run ./manage.py makemigrations
migrate:
docker-compose -f dev.yml down
docker-compose -f docker-compose.yml down
DOCKER_HOST=ssh://vps docker-compose -f dev.ym up -d --build --force-recreate --remove-orphans website-test
migrate: update
pipenv run ./manage.py migrate
shell:
pipenv run ./manage.py shell
test:
pipenv run ./manage.py runserver 0.0.0.0:8000 &
curl localhost:8000
kill %
brewstart:
brew services start mysql
brew services start redis
brewstop:
brew services stop mysql
brew services stop redis
dev:
docker-compose -f dev.yml up -d --build --remove-orphans
exec docker-compose -f dev.yml logs -f
prod:
docker-compose -f docker-compose.yml up -d --build --remove-orphans
clean:
docker-compose -f docker-compose.yml down
docker-compose -f dev.yml down
deploy:
DOCKER_HOST=ssh://vps docker-compose -f dev.yml up -d --build --force-recreate --remove-orphans website-test
DOCKER_HOST=ssh://vps docker-compose -f docker-compose.dev.ym logs -f website-test
.env:
echo HOST=localhost > .env
echo PORT=8000 >> .env
echo PRODUCTION=false >> .env
echo NOSETUP=true >> .env
echo SECRET=$$(date +%s | sha256sum | base64 | head -c 32 && echo) >> .env
+5 -2
View File
@@ -98,7 +98,6 @@ pipdeptree = "*"
pipupgrade = "*"
priority = "*"
prompt-toolkit = "*"
psycopg2= "*"
psycopg2-binary = "*"
ptyprocess = "*"
pyasn1 = "*"
@@ -153,9 +152,13 @@ SecretStorage = "*"
service_identity = "*"
Twisted = "*"
django-robots = "*"
selenium = "*"
geckodriver-autoinstaller = "*"
[dev-packages]
black = "*"
jedi = "*"
pylint = "*"
[requires]
python_version = "3.7.7"
python_version = "3.7.12"
Generated
+1054 -665
View File
File diff suppressed because it is too large Load Diff
+8 -7
View File
@@ -1,9 +1,5 @@
author: Marc Partensky
name: Website of Marc Partensky
date: 8/10/2019
---
[![ViewCount](http://hits.dwyl.com/MarcPartensky/website.svg)](https://github.com/MarcPartensky/Website)
[![Docker](https://github.com/MarcPartensky/Website/actions/workflows/docker-push.yml/badge.svg)](https://github.com/MarcPartensky/Website/actions/workflows/docker-push.yml)
[![CodeQL](https://github.com/MarcPartensky/Website/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/MarcPartensky/Website/actions/workflows/codeql-analysis.yml)
# Website
@@ -77,7 +73,12 @@ Build usually last 5 minutes.
![qrcode](./static/qrcode.svg)
**Scan to add me as a contact**
## Bonus
# Bonus
## Notes
author: Marc Partensky
name: Website of Marc Partensky
date: 8/10/2019
## Heroku Buildpacks
+23
View File
@@ -0,0 +1,23 @@
# Generated by Django 3.1.7 on 2021-10-25 16:10
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='NotificationModel',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('message', models.TextField()),
('source', models.GenericIPAddressField()),
('timestamp', models.DateTimeField(auto_now_add=True)),
('seen', models.BooleanField(default=False)),
],
),
]
+13
View File
@@ -17,3 +17,16 @@ class MarkdownModel(models.Model):
# print('saving model somewhere')
# print(args, kwargs)
# return super().save(*args, **kwargs)
class NotificationModel(models.Model):
"""A model that represents a notification."""
message = models.TextField()
source = models.GenericIPAddressField()
timestamp = models.DateTimeField(auto_now_add=True)
seen = models.BooleanField(default=False)
def __str__(self):
"""Return the notification sent."""
return f"{self.message}"
@@ -0,0 +1,32 @@
from django.db import models
class MarkdownModel(models.Model):
"""A model to store markdown files"""
title = models.CharField(max_length=80)
file = models.FileField(upload_to="markdown/")
class Meta:
ordering = ["title"]
def __str__(self):
return f"{self.title}"
# def save(self, *args, **kwargs):
# print('saving model somewhere')
# print(args, kwargs)
# return super().save(*args, **kwargs)
class NotificationModel(models.Model):
"""A model that represents a notification."""
message = models.TextField()
source = models.GenericIPAddressField()
timestamp = models.DateTimeField(auto_now_add=True)
seen = models.BooleanField(default=False)
def __str__(self):
"""Return the notification sent."""
return f"{self.message}"
+17 -1
View File
@@ -20,7 +20,7 @@ from rest_framework.views import APIView
from .forms import UploadFileForm, UploadMarkdownForm, TodoForm
from django.views.decorators.csrf import csrf_exempt
from .models import MarkdownModel
from .models import MarkdownModel, NotificationModel
from todo.models import Todo
@@ -243,3 +243,19 @@ def port(request: HttpRequest, n: int = 1):
result = subprocess.check_output(cmd, shell=True)
print(result)
return HttpResponse(result)
@csrf_exempt
def notify(request: HttpRequest):
"""Notify me with a get request container
a get variable `message`."""
message = request.GET.get("message")
return HttpResponse("")
@csrf_exempt
def notifications(request: HttpRequest):
"""Return the list of notifications."""
notifications = NotificationModel.objects.filter(seen=False)
for notification in notifications:
notification.seen = True
notification.save()
return JsonResponse(notifications)
+25 -24
View File
@@ -1,23 +1,19 @@
import time
import os
import glob
import random
import datetime
import requests
from django.shortcuts import render, HttpResponse, Http404
from django.core.exceptions import PermissionDenied
from django.template import loader
from .models import Article
from .forms import ArticleForm
from .adapt import adapt
from django.template.loader import engines
from django.views.decorators.csrf import csrf_exempt
from django.contrib.auth.decorators import login_required
from home.context import home, hydrate
from .context import get_articles_objects
from rich import print
@@ -55,14 +51,16 @@ def clean_templates():
static_cache_path = os.path.join(os.getcwd(), "article/static/article/cache")
templates_cache_path = os.path.join(os.getcwd(), "article/templates/cache")
os.system(f"rm -rf {static_cache_path}")
if os.path.exists(static_cache_path):
os.system(f"rm -rf {static_cache_path}")
# print("static:", static_cache_path)
# print("templates:", templates_cache_path)
print(
"before deleting templates",
os.listdir(templates_cache_path),
)
if os.path.exists(templates_cache_path):
print(
"before deleting templates",
os.listdir(templates_cache_path),
)
path = os.path.join(templates_cache_path, "*")
# print('path:', path)
for file in glob.glob(path):
@@ -79,7 +77,6 @@ def build_template(title: str, article: Article, layout: str = "marc"):
markdown_path = os.path.join(os.getcwd(), f"media/article/{title}.md")
html_path = os.path.join(os.getcwd(), f"article/templates/cache/{title}.html")
article_templates = os.path.join(os.getcwd(), "article/templates/cache")
article_static = os.path.join(os.getcwd(), "article/static/article")
with open(markdown_path, "w") as f:
@@ -106,22 +103,28 @@ def build_template(title: str, article: Article, layout: str = "marc"):
# else:
os.system(f"mv {layout_path} {article_static}")
with open(html_path, "r") as f:
text = str(f.read())
with open(html_path, "r") as stream:
text = str(stream.read())
text = adapt(text, title, layout)
with open(html_path, "w") as f:
f.write(text)
with open(html_path, "w") as stream:
stream.write(text)
def read(request, title: str):
"""Read an article."""
reset_template_cache()
clean_templates()
print("title", title)
title_no_extension = "".join(title.split(".")[:-1])
print("title no extension:", title_no_extension)
if "." in title:
title_no_extension = "".join(title.split(".")[:-1])
else:
title_no_extension = title
print("title_no_extension", title_no_extension)
article = Article.objects.filter(title=title_no_extension).first()
# article = Article.objects.all()[0]
print("article.layout:", article.layout)
if not article:
raise Http404("This article was not found.")
@@ -232,16 +235,14 @@ def upload(request):
d = fetch_article_data(request.FILES["file"], request)
form = ArticleForm(d)
if form.is_valid():
print(f"[lightgreen]valid form[/]")
print("[lightgreen]valid form[/]")
form.save()
return HttpResponse("success")
else:
print(f"[red]invalid form[/]")
print(f"[red]{form.errors.as_data()}[/]")
return HttpResponse("invalid form", status=500)
elif request.method == "GET":
print("[red]invalid form[/]")
print(f"[red]{form.errors.as_data()}[/]")
return HttpResponse("invalid form", status=500)
if request.method == "GET":
form = ArticleForm()
context = dict(form=form)
return render(request, "api/upload.html", context)
else:
raise PermissionDenied("Only GET and POST methods are allowed")
raise PermissionDenied("Only GET and POST methods are allowed")
+145
View File
@@ -0,0 +1,145 @@
version: "3.9"
x-common:
website:
&website
DJANGO_SETTINGS_MODULE: django_project.settings
SECRET_KEY: admin
FTP_URL: 0.0.0.0:21
USER: admin
PASSWORD: admin
EMAIL: admin@admin.com
postgres:
&postgres
POSTGRES_DB: website
POSTGRES_USER: admin
POSTGRES_PASSWORD: admin
POSTGRES_HOST: postgres
POSTGRES_PORT: 5432
redis:
&redis
REDIS_URL: redis:6379
services:
# nginx:
# image: jwilder/nginx-proxy
# restart: unless-stopped
# networks:
# - web
# ports:
# - "127.0.1.1:80:80"
# volumes:
# - /var/run/docker.sock:/tmp/docker.sock:ro
website:
image: marcpartensky/website
environment:
<<: *website
<<: *postgres
<<: *redis
VIRTUAL_HOST: website.dev
build:
context: .
dockerfile: ./Dockerfile
ports:
- "127.0.0.1:8000:80"
working_dir: /app
entrypoint: /app/entrypoint.sh
command: 80 0.0.0.0
volumes:
- ".:/app"
depends_on:
- redis
- postgres
networks:
- web
postgres:
image: postgres
environment:
<<: *postgres
ports:
- "127.0.0.1:5432:5432"
networks:
- web
# pgadmin:
# image: dpage/pgadmin4
# restart: unless-stopped
# environment:
# PGADMIN_DEFAULT_EMAIL: admin@admin.com
# PGADMIN_DEFAULT_PASSWORD: admin
# VIRTUAL_HOST: postgres.dev
# volumes:
# - dev_pgadmin:/var/lib/pgadmin
# ports:
# - "15432:80"
# networks:
# - web
pgweb:
image: sosedoff/pgweb
restart: unless-stopped
ports:
- "127.0.0.1:15432:8081"
environment:
DATABASE_URL: "postgres://admin:admin@postgres:5432/website?sslmode=disable"
networks:
- web
depends_on:
- postgres
redis:
image: redis
environment:
<<: *redis
ports:
- "127.0.0.1:6379:6379"
networks:
- web
rediscommander:
image: rediscommander/redis-commander
restart: unless-stopped
environment:
VIRTUAL_HOST: redis.dev
REDIS_HOST: redis:6379
ports:
- "127.0.0.1:16379:8081"
networks:
- web
website-test:
environment:
<<: *website
<<: *postgres
<<: *redis
VIRTUAL_HOST: website.dev
build:
context: .
dockerfile: ./Dockerfile
working_dir: /app
entrypoint: /app/entrypoint.sh
command: 80 0.0.0.0
volumes:
- ".:/app"
networks:
- web
- caddy
healthcheck:
test: ["CMD", "curl", "-fs", "http://website:80/robots.txt"]
interval: 1m30s
timeout: 10s
retries: 3
start_period: 40s
labels:
- "caddy=test.marcpartensky.com"
- "caddy.reverse_proxy={{upstreams http 80}}"
networks:
web:
caddy:
external: true
volumes:
dev_posgres:
dev_pgadmin:
+44 -19
View File
@@ -197,27 +197,50 @@ COMPRESS_OFFLINE = True
WSGI_APPLICATION = "django_project.wsgi.application"
# Database
debug = {
DATABASES = {}
postgres_name = os.environ.get("POSTGRES_DB")
if postgres_name:
postgres_database = {
"ENGINE": "django.db.backends.postgresql",
"NAME": postgres_name,
"USER": os.environ.get("POSTGRES_USER"),
"PASSWORD": os.environ.get("POSTGRES_PASSWORD"),
"HOST": os.environ.get("POSTGRES_HOST"),
"PORT": os.environ.get("POSTGRES_PORT"),
}
DATABASES["default"] = postgres_database
print("PostgreSQL logins detected, using those as default")
mysql_name = os.environ.get("MYSQL_DATABASE")
if mysql_name:
mysql_database = {
"ENGINE": "django.db.backends.mysql",
"NAME": mysql_name,
"USER": os.environ.get("MYSQL_USER"),
"PASSWORD": os.environ.get("MYSQL_PASSWORD"),
"HOST": os.environ.get("MYSQL_HOST"),
"PORT": os.environ.get("MYSQL_PORT"),
}
if "default" not in DATABASES:
DATABASES["default"] = mysql_database
print("MySQL logins detected, using those as default")
else:
DATABASES["mysql"] = mysql_database
print("MySQL logins detected, using as second database")
local_db = {
"ENGINE": "django.db.backends.sqlite3",
"NAME": os.path.join(BASE_DIR, "db.sqlite3"),
}
production = {
"ENGINE": "django.db.backends.postgresql",
"NAME": os.environ.get("POSTGRES_NAME"),
"USER": os.environ.get("POSTGRES_USER"),
"PASSWORD": os.environ.get("POSTGRES_PASSWORD"),
"HOST": os.environ.get("POSTGRES_HOST"),
"PORT": os.environ.get("POSTGRES_PORT"),
}
if DEBUG:
DATABASES = dict(default=debug, production=production)
if "default" not in DATABASES:
DATABASES["default"] = local_db
print("No database detected, using local MySQL database as default")
else:
DATABASES = dict(default=production, debug=debug)
DATABASES["debug"] = local_db
print("Using local MySQL database as debug database")
# print('production port:', os.environ.get('POSTGRES_PORT'))
# print("DATABASES:", DATABASES)
# DATABASES = {
# 'default': {
@@ -451,10 +474,12 @@ MDEDITOR_CONFIGS = {
# SQL Explorer : https://pypi.org/project/django-sql-explorer/
# EXPLORER_DEFAULT_CONNECTION = 'readonly'
if DEBUG:
EXPLORER_CONNECTIONS = {"Default": "default", "Production": "production"}
else:
EXPLORER_CONNECTIONS = {"Default": "default", "Debug": "debug"}
EXPLORER_CONNECTIONS = {"Default": "default"}
if "mysql" in DATABASES:
EXPLORER_CONNECTIONS["Mysql"] = "mysql"
if "debug" in DATABASES:
EXPLORER_CONNECTIONS["Debug"] = "debug"
EXPLORER_DEFAULT_CONNECTION = "default"
+6 -4
View File
@@ -1,19 +1,20 @@
from django.contrib import admin
from django.contrib.auth import views as auth_views
from django.http import HttpResponse
from django.urls import path, include
from django.conf import settings
from django.conf.urls.static import static
from django.core.exceptions import ViewDoesNotExist
# def response_error_handler(request, exception=None):
# raise HttpResponse('<div class="tenor-gif-embed" data-postid="5094560" data-share-method="host" data-width="100%" data-aspect-ratio="1.7543859649122806"><a href="https://tenor.com/view/elmo-shrug-gif-5094560">Elmo Shrug GIF</a> from <a href="https://tenor.com/search/elmo-gifs">Elmo GIFs</a></div><script type="text/javascript" async src="https://tenor.com/embed.js"></script>', status=404)
def not_found_view(request):
raise ViewDoesNotExist
def healthcheck(request):
return HttpResponse(content="Ok")
urlpatterns = [
path("admin/", admin.site.urls),
# path('users/login/', auth_views.LoginView.as_view()),
@@ -43,6 +44,7 @@ urlpatterns = [
# path('accounts/', include('allauth.urls')),
path("mdeditor/", include("mdeditor.urls")),
path("404/", not_found_view, name="404"),
path("live", healthcheck, name="healthcheck"),
path("business/", include("business.urls")),
path("avatar/", include("avatar.urls")),
path("robots.txt", include("robots.urls")),
+4 -11
View File
@@ -3,13 +3,13 @@ x-common:
website:
&website
DJANGO_SETTINGS_MODULE: django_project.settings
SECRET_KEY: openssl rand -base64 64
SECRET_KEY: "$${openssl rand -base64 64}"
FTP_URL: 0.0.0.0:21
postgres:
&postgres
POSTGRES_NAME: website
POSTGRESQL_USER: root
POSTGRES_PASSWORD: openssl rand -base64 64
POSTGRES_PASSWORD: "$${openssl rand -base64 64}"
POSTGRES_HOST: postgres
POSTGRES_PORT: 5432
redis:
@@ -26,11 +26,9 @@ services:
context: .
dockerfile: Dockerfile
ports:
- "8000:8000"
- "8000:80"
working_dir: /app
entrypoint: >
sh -c "./manage.py migrate;
./manage.py runserver 0.0.0.0:8000"
entrypoint: /app/entrypoint.sh
depends_on:
- redis
- postgres
@@ -41,8 +39,6 @@ services:
image: redis
environment:
<<: *redis
ports:
- "6379:6379"
networks:
- website
@@ -50,9 +46,6 @@ services:
image: postgres
environment:
<<: *postgres
ports:
# - "3306:3306"
- "5432:5432"
networks:
- website
+37 -3
View File
@@ -1,5 +1,39 @@
#!/bin/sh
./manage.py makemigrations
./manage.py migrate
daphne django_project.asgi:application --port 80 --bind website -v2
port=${1:-$PORT}
host=${2:-$HOST}
port=${port:-"80"}
host=${addr:-"0.0.0.0"}
username=${DJANGO_SUPERUSER_USERNAME:-"admin"}
email=${DJANGO_SUPERUSER_EMAIL:-"admin@admin.com"}
DJANGO_SUPERUSER_PASSWORD=${PASSWORD:-$(date +%s | sha256sum | base64 | head -c 32)}
_kill() {
kill $(cat /tmp/website.pid)
}
if [ $1 = "kill" ]; then
_kill
exit 0
fi
echo $$ > /tmp/website.pid
setup() {
echo -e "Running \033[1mentrypoint.sh\033[0m using $HOST:$PORT"
./manage.py migrate
echo -e "Creating \033[1msuper user\033[0m using:\n - username: \033[1m$username\033[0m\n - email: \033[1m$email\033[0m\n"
./manage.py createsuperuser --user $username --email $email --noinput
./manage.py collectstatic --noinput --clear
}
if [[ ! -z $NOSETUP && ! $1 = "--nosetup" ]]; then
setup
fi
# dev vs prod
if [ -z $PRODUCTION ]; then
daphne django_project.asgi:application --port $port --bind $host -v2
else
./manage.py runserver 127.0.0.1:8000
fi
Binary file not shown.
Binary file not shown.
-2
View File
@@ -1,2 +0,0 @@
<p>fdp</p>
<!--<div class="tenor-gif-embed" data-postid="11924336" data-share-method="host" data-width="100%" data-aspect-ratio="1.3387096774193548"><a href="https://tenor.com/view/system-failure-system-down-error-gif-11924336">System Failure System Down GIF</a> from <a href="https://tenor.com/search/systemfailure-gifs">Systemfailure GIFs</a></div><script type="text/javascript" async src="https://tenor.com/embed.js"></script>-->
+24 -2
View File
@@ -1,3 +1,25 @@
from django.test import TestCase
import os
import geckodriver_autoinstaller
# Create your tests here.
from django.test import TestCase
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
class HomePageTestCase(TestCase):
def setUp(self):
"""Setup selenium."""
geckodriver_autoinstaller.install()
options = Options()
options.headless = True if os.environ.get("HEADLESS") != "False" else False
self.driver = webdriver.Firefox(options=options)
host = os.environ["HOST"]
port = os.environ["PORT"]
self.url = f"{host}:{port}"
def test_home_page_loads(self):
"""Animals that can speak are correctly identified"""
self.driver.get(self.url)
icon = self.driver.find_element_by_id("theme-img")
icon.click()
assert True
+71 -50
View File
@@ -13,9 +13,9 @@
}
},
"node_modules/ansi-regex": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz",
"integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==",
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
"engines": {
"node": ">=8"
}
@@ -93,9 +93,9 @@
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="
},
"node_modules/core-util-is": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
"integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac="
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz",
"integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ=="
},
"node_modules/emoji-regex": {
"version": "8.0.0",
@@ -173,9 +173,9 @@
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
},
"node_modules/is-core-module": {
"version": "2.5.0",
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.5.0.tgz",
"integrity": "sha512-TXCMSDsEHMEEZ6eCA8rwRDbLu55MRGmrctljsBX/2v1d9/GzqHOxW5c5oPSgrUt2vBFXebu9rGqckXGPWOlYpg==",
"version": "2.8.1",
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.8.1.tgz",
"integrity": "sha512-SdNCUs284hr40hFTFP6l0IfZ/RSrMXF3qgoRHd3/79unUTvrFO/JoXwkGm+5J/Oe3E/b5GsnG330uUNgRpu1PA==",
"dependencies": {
"has": "^1.0.3"
},
@@ -386,12 +386,16 @@
}
},
"node_modules/resolve": {
"version": "1.20.0",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz",
"integrity": "sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==",
"version": "1.21.0",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.21.0.tgz",
"integrity": "sha512-3wCbTpk5WJlyE4mSOtDLhqQmGFi0/TD9VPwmiolnk8U0wRgMEktqCXd3vy5buTO3tljvalNvKrjHEfrd2WpEKA==",
"dependencies": {
"is-core-module": "^2.2.0",
"path-parse": "^1.0.6"
"is-core-module": "^2.8.0",
"path-parse": "^1.0.7",
"supports-preserve-symlinks-flag": "^1.0.0"
},
"bin": {
"resolve": "bin/resolve"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
@@ -430,29 +434,40 @@
"integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ="
},
"node_modules/string-width": {
"version": "4.2.2",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.2.tgz",
"integrity": "sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA==",
"version": "4.2.3",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
"integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
"dependencies": {
"emoji-regex": "^8.0.0",
"is-fullwidth-code-point": "^3.0.0",
"strip-ansi": "^6.0.0"
"strip-ansi": "^6.0.1"
},
"engines": {
"node": ">=8"
}
},
"node_modules/strip-ansi": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz",
"integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==",
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
"integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
"dependencies": {
"ansi-regex": "^5.0.0"
"ansi-regex": "^5.0.1"
},
"engines": {
"node": ">=8"
}
},
"node_modules/supports-preserve-symlinks-flag": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz",
"integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==",
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/through2": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/through2/-/through2-4.0.2.tgz",
@@ -483,9 +498,9 @@
}
},
"node_modules/uglify-js": {
"version": "3.13.10",
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.13.10.tgz",
"integrity": "sha512-57H3ACYFXeo1IaZ1w02sfA71wI60MGco/IQFjOqK+WtKoprh7Go2/yvd2HPtoJILO2Or84ncLccI4xoHMTSbGg==",
"version": "3.14.5",
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.14.5.tgz",
"integrity": "sha512-qZukoSxOG0urUTvjc2ERMTcAy+BiFh3weWAkeurLwjrCba73poHmG3E36XEjd/JGukMzwTL7uCxZiAexj8ppvQ==",
"optional": true,
"bin": {
"uglifyjs": "bin/uglifyjs"
@@ -602,9 +617,9 @@
},
"dependencies": {
"ansi-regex": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz",
"integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg=="
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="
},
"ansi-styles": {
"version": "4.3.0",
@@ -667,9 +682,9 @@
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="
},
"core-util-is": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
"integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac="
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz",
"integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ=="
},
"emoji-regex": {
"version": "8.0.0",
@@ -727,9 +742,9 @@
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
},
"is-core-module": {
"version": "2.5.0",
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.5.0.tgz",
"integrity": "sha512-TXCMSDsEHMEEZ6eCA8rwRDbLu55MRGmrctljsBX/2v1d9/GzqHOxW5c5oPSgrUt2vBFXebu9rGqckXGPWOlYpg==",
"version": "2.8.1",
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.8.1.tgz",
"integrity": "sha512-SdNCUs284hr40hFTFP6l0IfZ/RSrMXF3qgoRHd3/79unUTvrFO/JoXwkGm+5J/Oe3E/b5GsnG330uUNgRpu1PA==",
"requires": {
"has": "^1.0.3"
}
@@ -920,12 +935,13 @@
"integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I="
},
"resolve": {
"version": "1.20.0",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz",
"integrity": "sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==",
"version": "1.21.0",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.21.0.tgz",
"integrity": "sha512-3wCbTpk5WJlyE4mSOtDLhqQmGFi0/TD9VPwmiolnk8U0wRgMEktqCXd3vy5buTO3tljvalNvKrjHEfrd2WpEKA==",
"requires": {
"is-core-module": "^2.2.0",
"path-parse": "^1.0.6"
"is-core-module": "^2.8.0",
"path-parse": "^1.0.7",
"supports-preserve-symlinks-flag": "^1.0.0"
}
},
"safe-buffer": {
@@ -944,23 +960,28 @@
"integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ="
},
"string-width": {
"version": "4.2.2",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.2.tgz",
"integrity": "sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA==",
"version": "4.2.3",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
"integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
"requires": {
"emoji-regex": "^8.0.0",
"is-fullwidth-code-point": "^3.0.0",
"strip-ansi": "^6.0.0"
"strip-ansi": "^6.0.1"
}
},
"strip-ansi": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz",
"integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==",
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
"integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
"requires": {
"ansi-regex": "^5.0.0"
"ansi-regex": "^5.0.1"
}
},
"supports-preserve-symlinks-flag": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz",
"integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w=="
},
"through2": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/through2/-/through2-4.0.2.tgz",
@@ -990,9 +1011,9 @@
}
},
"uglify-js": {
"version": "3.13.10",
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.13.10.tgz",
"integrity": "sha512-57H3ACYFXeo1IaZ1w02sfA71wI60MGco/IQFjOqK+WtKoprh7Go2/yvd2HPtoJILO2Or84ncLccI4xoHMTSbGg==",
"version": "3.14.5",
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.14.5.tgz",
"integrity": "sha512-qZukoSxOG0urUTvjc2ERMTcAy+BiFh3weWAkeurLwjrCba73poHmG3E36XEjd/JGukMzwTL7uCxZiAexj8ppvQ==",
"optional": true
},
"util-deprecate": {
+116 -91
View File
@@ -1,151 +1,176 @@
#
# These requirements were autogenerated by pipenv
# To regenerate from the project's Pipfile, run:
#
# pipenv lock --requirements
#
-i https://pypi.org/simple
aioredis==1.3.1
appdirs==1.4.4
appnope==0.1.2
arrow==1.1.0
asgiref==3.3.4
astroid==2.5.6
async-timeout==3.0.1
attrs==21.2.0
autobahn==21.3.1
Automat==20.2.0
arrow==1.2.1
asgiref==3.4.1
astroid==2.9.3
async-generator==1.10; python_version >= '3.5'
async-timeout==4.0.2
attrs==21.4.0
autobahn==21.11.1
automat==20.2.0
backcall==0.2.0
blessed==1.18.0
boto3==1.17.69
botocore==1.20.69
certifi==2020.12.5
cffi==1.14.5
channels==3.0.3
channels-redis==3.2.0
backports.zoneinfo==0.2.1; python_version < '3.9'
blessed==1.19.0
boto3==1.20.37
botocore==1.23.37
certifi==2021.10.8
cffi==1.15.0
channels-redis==3.3.1
channels==3.0.4
chardet==4.0.0
click==7.1.2
charset-normalizer==2.0.10; python_version >= '3'
click==8.0.3
colorama==0.4.4
commonmark==0.9.1
constantly==15.1.0
coverage==5.5
cryptography==3.4.7
coverage==6.2
cryptography==36.0.1
daphne==3.0.2
decorator==5.0.7
decorator==5.1.1
defusedxml==0.7.1
dj-database-url==0.5.0
Django==3.2.2
django-503==0.1
django-admin==2.0.1
django-allauth==0.44.0
django-appconf==1.0.4
django-allauth==0.47.0
django-appconf==1.0.5
django-avatar==5.0.0
django-compressor==2.4.1
django-compressor==3.1
django-cors-middleware==1.5.0
django-crispy-forms==1.11.2
django-crispy-forms==1.13.0
django-excel-base==1.0.4
django-excel-response2==3.0.2
django-extensions==3.1.3
django-extensions==3.1.5
django-ftpserver==0.7.0
django-heroku==0.3.1
django-jsonfield-backport==1.0.3
django-libsass==0.8
django-jsonfield-backport==1.0.4
django-libsass==0.9
django-markdown-view==0.0.4
django-mdeditor==0.1.18
django-mdeditor==0.1.20
django-picklefield==3.0.1
django-q==1.3.5
django-q==1.3.9
django-rename-app==0.1.3
django-robots==4.0
django-robots==5.0
django-shortuuidfield==0.1.3
django-six==1.0.4
django-sql-explorer==2.1.2
django-storages==1.11.1
djangorestframework==3.12.4
django-sql-explorer==2.3
django-storages==1.12.3
django==3.2.11
djangorestframework==3.13.1
docopt==0.6.2
docutils==0.17.1
docutils==0.18.1
flake8==3.9.2
future==0.18.2
graphviz==0.16
geckodriver-autoinstaller==0.1.0
graphviz==0.19.1
gunicorn==20.1.0
h2==4.0.0
h11==0.12.0; python_version >= '3.6'
h2==4.1.0
hiredis==2.0.0
hpack==4.0.0
hyperframe==6.0.1
hyperlink==21.0.0
idna==2.10
importlib-metadata==4.0.1
idna==3.3
importlib-metadata==4.10.1
incremental==21.3.0
ipython==7.23.1
ipython-genutils==0.2.0
isort==5.8.0
jedi==0.18.0
jeepney==0.6.0
ipython==7.31.0
isort==5.10.1
jedi==0.18.1
jeepney==0.7.1
jmespath==0.10.0
keyring==23.0.1
keyring==23.5.0
keyrings.alt==3.2.0
lazy-object-proxy==1.6.0
libsass==0.20.1
Markdown==3.2.2
matplotlib-inline==0.1.2
lazy-object-proxy==1.7.1
libsass==0.21.0
markdown==3.2.2
matplotlib-inline==0.1.3; python_version >= '3.5'
mccabe==0.6.1
mock==4.0.3
msgpack==1.0.2
msgpack-python==0.5.6
msgpack==1.0.3
mypy-extensions==0.4.3
nose==1.3.7
oauthlib==3.1.0
packaging==20.9
parso==0.8.2
pathspec==0.8.1
oauthlib==3.1.1
outcome==1.1.0; python_version >= '3.6'
packaging==21.3; python_version >= '3.6'
parso==0.8.3
pathspec==0.9.0
pexpect==4.8.0
pickleshare==0.7.5
Pillow==8.2.0
pip-autoremove==0.9.1
pillow==9.0.0
pip-autoremove==0.10.0
pip-conflict-checker==0.6.0
pip-review==1.1.0
pipdeptree==2.0.0
pipupgrade==1.9.0
priority==1.3.0
prompt-toolkit==3.0.18
psycopg2==2.8.6
psycopg2-binary==2.8.6
pip-review==1.1.1
pip==21.3.1; python_version >= '3.6'
pipdeptree==2.2.1
pipupgrade==1.11.0
platformdirs==2.4.1; python_version >= '3.7'
priority==2.0.0
prompt-toolkit==3.0.24
psycopg2-binary==2.9.3
psycopg2==2.9.3; python_version >= '3.6'
ptyprocess==0.7.0
pyasn1==0.4.8
pyasn1-modules==0.2.8
pyasn1==0.4.8
pycodestyle==2.7.0
pycparser==2.20
pycparser==2.21
pyflakes==2.3.1
pyftpdlib==1.5.6
Pygments==2.9.0
PyHamcrest==2.0.2
PyJWT==2.1.0
pylint==2.8.2
pyOpenSSL==20.0.1
pyparsing==2.4.7
python-dateutil==2.8.1
python-dotenv==0.17.1
pygments==2.11.2
pyhamcrest==2.0.3
pyjwt==2.3.0
pylint==2.12.2
pyopenssl==21.0.0
pyparsing==3.0.6
python-dateutil==2.8.2
python-dotenv==0.19.2
python3-openid==3.2.0
pytz==2021.1
PyYAML==5.4.1
rcssmin==1.0.6
pytz-deprecation-shim==0.1.0.post0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5'
pytz==2021.3
pyyaml==6.0
rcssmin==1.1.0
redis==3.5.3
regex==2021.4.4
requests==2.25.1
regex==2021.11.10
requests-oauthlib==1.3.0
rich==10.1.0
rjsmin==1.1.0
s3transfer==0.4.2
requests==2.27.1
rich==11.0.0
rjsmin==1.2.0
s3transfer==0.5.0
screen==1.0.1
SecretStorage==3.3.1
service-identity==18.1.0
shortuuid==1.0.1
secretstorage==3.3.1
selenium==4.1.0
service-identity==21.1.0
setuptools==60.5.0; python_version >= '3.7'
shortuuid==1.0.8
six==1.16.0
sqlparse==0.4.1
sniffio==1.2.0; python_version >= '3.5'
sortedcontainers==2.4.0
sqlparse==0.4.2
toml==0.10.2
traitlets==5.0.5
Twisted==21.2.0
traitlets==5.1.1
trio-websocket==0.9.2; python_version >= '3.5'
trio==0.19.0; python_version >= '3.6'
twisted==21.7.0
txaio==21.2.1
typed-ast==1.4.3
typing-extensions==3.10.0.0
tzlocal==2.1
urllib3==1.26.4
typed-ast==1.5.1
typing-extensions==4.0.1
tzdata==2021.5; python_version >= '3.6'
tzlocal==4.1
urllib3==1.26.8
wcwidth==0.2.5
whitenoise==5.2.0
wrapt==1.12.1
whitenoise==5.3.0
wrapt==1.13.3
wsproto==1.0.0; python_full_version >= '3.6.1'
xlwt==1.3.0
yarg==0.1.9
zipp==3.4.1
zipp==3.7.0
zope.interface==5.4.0
+1 -33
View File
@@ -27,21 +27,6 @@ django() {
pipenv run daphne -e "ssl:${PORT}:privateKey=${KEY}:certKey=${CERT}" django_project.asgi:application
}
alias run=django
up() {
postgres
redis
django
}
down() {
docker-compose down
echo -e "Ended \e[31mRedis\e[0m"
echo -e "Ended \e[31mPostgreSQL\e[0m"
kill % && echo -e "Ended \e[31mDjango\e[0m" && echo -e "Ended \e[31mFTP\e[0m"
}
ftp() {
echo -e "Starting \e[92mFTP Server\e[0m"
pipenv run ./manage.py ftpserver $FTP_URL
@@ -53,24 +38,7 @@ all() {
down
}
# build the project for docker
build() {
pipenv run ./manage.py collectstatic --noinput
docker build . -t marcpartensky/website
docker push marcpartensky/website
git pull --all
git push -ll
}
deploy() {
pipenv run ./manage.py collectstatic --noinput
pipenv run ./manage.py makemigrations
pipenv run ./manage.py migrate
run
}
update() {
updatepip() {
git pull
pipenv run pip install -U pip
pipenv run pip install -r requirements.txt -U
+1 -1
View File
@@ -1 +1 @@
<div class="tenor-gif-embed" data-postid="11924336" data-share-method="host" data-width="100%" data-aspect-ratio="1.3387096774193548"><a href="https://tenor.com/view/system-failure-system-down-error-gif-11924336">System Failure System Down GIF</a> from <a href="https://tenor.com/search/systemfailure-gifs">Systemfailure GIFs</a></div><script type="text/javascript" async src="https://tenor.com/embed.js"></script>
500