Skip to content

Commit

Permalink
delete account and randomize list order functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
sahil5444 committed Nov 7, 2024
1 parent a1f137d commit fa603c2
Show file tree
Hide file tree
Showing 254 changed files with 25,538 additions and 13,900 deletions.
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
fly.toml
.git/
*.sqlite3
.venv
.env
data/
media/
73 changes: 73 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# If you use AWS S3-style object storage, you need to set the following
# environment variables for 'django-storages', the library used by Django
# connect to the environment. These need to be absolute paths.
AWS_SHARED_CREDENTIALS_FILE=.aws.YOURNAME.credentials
AWS_CONFIG_FILE=.aws.YOURNAME.config

# TODO: check if we need this
# AWS_S3_CUSTOM_DOMAIN="https://yourname-cl8.s3.nl-ams.scw.cloud"

# If you use object storage, you need to set the following environment variables
# for 'django-storages', the library used by
DJANGO_AWS_ACCESS_KEY_ID=XXXXXXXXXXXXXXXXXXXX
DJANGO_AWS_SECRET_ACCESS_KEY=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
DJANGO_AWS_STORAGE_BUCKET_NAME=your-bucket-name

# if you are using Scaleway or another S3 compatible provider, instead of AWS
# you need to set the following environment variables to connect to the
# correct servers. The vales below are defaults for Scaleway
DJANGO_AWS_S3_REGION_NAME=nl-ams
DJANGO_AWS_S3_ENDPOINT_URL=https://s3.nl-ams.scw.cloud


# Set this to True if you want to allow sign ups to your directory
ACCOUNT_ALLOW_REGISTRATION=False

# This is the connection string used by Django to connect to the database
DATABASE_URL=postgres://localhost:5432/cl8

# TODO: needed?
# DJANGO_ADMIN_URL=admin

# Set this to the domain name of your website - it is set to a wildcard
# by default for development
DJANGO_ALLOWED_HOSTS=*

DJANGO_DEBUG=True
DJANGO_SECRET_KEY="long-random-string"

# the default settings module. Set this to config.settings.production for production
DJANGO_SETTINGS_MODULE=config.settings.local

# If you ae connecting to Google Spreadsheets to pull data down for profiles you need these.
# SPREADSHEET_KEY is the identifier of the spreadsheet you want to connect to, usually listed
# i the url when you visit a google sheet in a browser
# DJANGO_GSPREAD_SERVICE_ACCOUNT_FILE_PATH="./path-to.google.service-account.json"
# DJANGO_GSPREAD_SPREADSHEET_KEY="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-xxxxxx"


# This defines the slack channel to import users from.
# DJANGO_SLACK_CHANNEL_NAME="public-slack-channel"
# This defines the slack token used when sending API requests from the server
# to fetch users using the slack importers. This is bot token, identified by the
# xoxb- prefix. You can get this from the slack admin panel

# DJANGO_SLACK_TOKEN="xoxb-111111111111-1111111111111-x1x1x1x1x1x1x1x1x1x1x1x1"

# These define the client id, secret, token, and authorize url used by allauth's
# social login to connect to slack.

# This is a slack user token, identified by the xoxp- prefix. You can get this from
# the slack admin panel
# DJANGO_SLACK_USER_TOKEN="xoxp-111111111111-111111111111-1111111111111-x1x1x1x1x1x1x1x1x1x1x1x1x1x1x1x1"
# DJANGO_SLACK_SIGNIN_AUTHORIZE_URL="https://your-slack-workspace.slack.com/openid/connect/authorize"

# Thse define the airtables used to pull data down for profiles and import.
# the BEARER token is send with every API request, and the BASE and TABLE
# identify the airtable and the table within it to connect fetch data from

# Setting this stops python creating .pyc files in the workspace
PYTHONDONTWRITEBYTECODE=1

# Used by django to set a more convenient breakpoint when debugging
PYTHONBREAKPOINT="ipdb.set_trace"
7 changes: 7 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[flake8]
# Recommend matching the black line length (default 88),
# rather than using the flake8 default of 79:
max-line-length = 88
extend-ignore =
# See https://github.com/PyCQA/pycodestyle/issues/373
E203,
52 changes: 52 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: CI

on: [push]

jobs:
build:
runs-on: ubuntu-latest

services:
postgres:
image: postgres:12-alpine
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: backend
ports:
- 5432:5432
# needed because the postgres container does not provide a healthcheck
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

strategy:
matrix:
python-version: [3.11]

steps:
- name: install just binary for running commands
uses: taiki-e/install-action@just

- uses: actions/checkout@v2

- name: Use Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install front end dependencies from front end directory
run: |
cd theme/static_src
npm i
cd ../../
- name: Install dependencies
run: |
python -m pip install pipenv
python -m pipenv install --dev
- name: Run tests
run: |
just test --no-migrations
env:
CI: true
DATABASE_URL: "postgres://postgres:postgres@localhost:5432/backend"
113 changes: 113 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class


# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/

# Translations
*.mo
*.pot

# Django stuff:
staticfiles/

# Virtual Environments
.venv
.python-version
.tool-versions

# Env Vars

!.envs/.local/

# mypy
.mypy_cache/

### Node template
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*


### macOS template
# General
*.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*


# node

node_modules

# vs code

.vscode

### Project template

MailHog
media/

.pytest_cache/

.env
.envs/*
envs/

data/

cruft

venv/
db.sqlite3
justfile2
# package-lock.json
# package.json
.env.sample/*


**/migrations/*
!**/migrations/__init__.py
36 changes: 36 additions & 0 deletions .gitpod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# This configuration file was automatically generated by Gitpod.
# Please adjust to your needs (see https://www.gitpod.io/docs/introduction/learn-gitpod/gitpod-yaml)
# and commit this file to your remote git repository to share the goodness with others.

# Learn more from ready-to-use templates: https://www.gitpod.io/docs/introduction/getting-started/quickstart

# make sure we have access to a running version of postgres
image: gitpod/workspace-postgres

tasks:
- name: main
init: |
# install just - its like make but better
curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --to just-dir
mv just-dir/just /home/gitpod/.local/bin/just
rm -rf just-dir
# # create database, install our dependencies, and run migrations
cp .env.sample .env
createdb cl8
just install
gp sync-done installed
- name: tailwind
command: |
gp sync-await installed
just tailwind-dev
- name: mailhog
command: >
docker run
--rm
--name mailhog
-p 8025:8025
-p 1025:1025
mailhog/mailhog
24 changes: 24 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
exclude: 'docs|node_modules|migrations|.git|.tox'
default_stages: [commit]
fail_fast: true

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: master
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml

- repo: https://github.com/psf/black
rev: 19.10b0
hooks:
- id: black

- repo: https://gitlab.com/pycqa/flake8
rev: 3.8.3
hooks:
- id: flake8
args: ['--config=setup.cfg']
additional_dependencies: [flake8-isort]

14 changes: 14 additions & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[MASTER]
load-plugins=pylint_django

[FORMAT]
max-line-length=120

[MESSAGES CONTROL]
disable=missing-docstring,invalid-name

[DESIGN]
max-parents=13

[TYPECHECK]
generated-members=REQUEST,acl_users,aq_parent,"[a-zA-Z]+_set{1,2}",save,delete
4 changes: 4 additions & 0 deletions .snyk
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Snyk (https://snyk.io) policy file, patches or ignores known vulnerabilities.
version: v1.14.1
ignore: {}
patch: {}
13 changes: 13 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"prettier.eslintIntegration": true,
"prettier.singleQuote": true,
"prettier.semi": false,
"i18n-ally.localesPaths": [
"backend/locale",
"frontend/src/locales"
],
"python.formatting.provider": "black",
"python.analysis.extraPaths": [
"${workspaceFolder}/.venv/**"
]
}
1 change: 1 addition & 0 deletions CONTRIBUTORS.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Chris Adams
32 changes: 32 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
ARG PYTHON_VERSION=3.11-slim-buster

FROM python:${PYTHON_VERSION}

ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1

RUN mkdir -p /code

WORKDIR /code

# install node
RUN apt update --yes
RUN apt install curl --yes
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
RUN apt install --yes build-essential nodejs


RUN pip install pipenv

COPY Pipfile Pipfile.lock /code/
# RUN pipenv install --production --system
RUN pipenv install --dev --system

COPY . /code
RUN python manage.py tailwind install
RUN python manage.py tailwind build
RUN python manage.py collectstatic --noinput

EXPOSE 8000

CMD ["gunicorn", "--bind", ":8000", "--workers", "2", "config.wsgi"]
Loading

0 comments on commit fa603c2

Please sign in to comment.