Skip to content

Commit

Permalink
Merge pull request #1 from ElveeBolt/dev
Browse files Browse the repository at this point in the history
Merge dev branch
  • Loading branch information
ElveeBolt committed Mar 8, 2023
2 parents de3a72e + 46c2bf1 commit 42cc071
Show file tree
Hide file tree
Showing 93 changed files with 25,288 additions and 1 deletion.
9 changes: 9 additions & 0 deletions .env.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
DEBUG = 1
ALLOWED_HOSTS = localhost 127.0.0.1 0.0.0.0 [::1]

SQL_ENGINE = django.db.backends.postgresql
SQL_DATABASE = forestwork
SQL_USER = postgres
SQL_PASSWORD = password
SQL_HOST = postgres
SQL_PORT = 5432
43 changes: 43 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Django
*.log
*.pot
*.pyc
__pycache__
db.sqlite3
media

# Backup files
*.bak

# PyCharm
.idea

# Python
*.py[cod]
*$py.class

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

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Only for Development only
**/migrations/**
!**/migrations
!**/migrations/__init__.py
46 changes: 45 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,46 @@
# 馃尦 ForestWork
**Forestwork** - please see the <code>**DEV** branch</code>.
![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/ElveeBolt/forestwork)
[![Supported python versions](https://img.shields.io/badge/python-3.10-blue)](https://www.python.org/downloads/)
[![Code style](https://img.shields.io/badge/code%20style-PEP8-blue)](https://peps.python.org/pep-0008/)

**Forestwork** - job search service for developers and employers.


## Installing ForestWork

```bash
# Clone this repo and create virtual environment
git clone https://github.com/ElveeBolt/Forestwork.git
cd Forestwork

# For Linux/Ubuntu
python3 -m venv venv
source venv\bin\activate
pip install -r requirements.txt

# For Windows
python -m venv venv
venv\Scripts\activate
pip install -r requirements.txt
```

## Installing with Docker Compose
```bash
# Clone this repo and and build docker containers
git clone https://github.com/ElveeBolt/Forestwork.git
cd Forestwork

docker compose up --build
```

## Run ForestWork
```bash
python manage.py runserver
```

After starting, you can go to http://127.0.0.1:8000/ and use ForestWork app

## Author
Developed and maintained by [ElveeBolt](https://github.com/ElveeBolt).

Thanks to everybody that has contributed pull requests, ideas, issues, comments and kind words.
24 changes: 24 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
version: "3.9"
services:
web:
hostname: 'web'
restart: 'always'
build: ./forestwork
command: python manage.py runserver 0.0.0.0:8000
ports:
- "8000:8000"
env_file:
- ./.env.dev
depends_on:
- postgres

postgres:
hostname: "postgres"
restart: 'always'
image: "postgres:13.2"
ports:
- "5432:5432"
environment:
POSTGRES_USER: 'postgres'
POSTGRES_PASSWORD: 'password'
POSTGRES_DB: 'forestwork'
11 changes: 11 additions & 0 deletions forestwork/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# syntax=docker/dockerfile:1

FROM python

WORKDIR /forestwork

COPY requirements.txt requirements.txt

RUN pip install -r requirements.txt

COPY . .
Empty file.
16 changes: 16 additions & 0 deletions forestwork/forestwork/asgi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""
ASGI config for forestwork project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/4.1/howto/deployment/asgi/
"""

import os

from django.core.asgi import get_asgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'forestwork.settings')

application = get_asgi_application()
152 changes: 152 additions & 0 deletions forestwork/forestwork/settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
"""
Django settings for forestwork project.
Generated by 'django-admin startproject' using Django 4.1.6.
For more information on this file, see
https://docs.djangoproject.com/en/4.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/4.1/ref/settings/
"""

import os
from pathlib import Path

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/4.1/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-!_r9*)_k&5r23jl7g_ajp&z8$5=^9v!^(=8$q%9en$m2#61vh%'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = int(os.environ.get("DEBUG", default=True))

ALLOWED_HOSTS = os.environ.get('ALLOWED_HOSTS', '127.0.0.1').split(' ')

EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'

# Application definition

INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'main',
'jobs',
'users',
'user_profile',
]

MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

ROOT_URLCONF = 'forestwork.urls'

TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [BASE_DIR / 'templates'],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]

WSGI_APPLICATION = 'forestwork.wsgi.application'


# Database
# https://docs.djangoproject.com/en/4.1/ref/settings/#databases

DATABASES = {
'default': {
'ENGINE': os.environ.get('SQL_ENGINE', 'django.db.backends.sqlite3'),
'NAME': os.environ.get('SQL_DATABASE', BASE_DIR / 'db.sqlite3'),
'USER': os.environ.get('SQL_USER', 'user'),
'PASSWORD': os.environ.get('SQL_PASSWORD', 'password'),
'HOST': os.environ.get('SQL_HOST', 'localhost'),
'PORT': os.environ.get('SQL_PORT', '5432'),
}
}


# Password validation
# https://docs.djangoproject.com/en/4.1/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]

AUTH_USER_MODEL = 'users.User'


# Internationalization
# https://docs.djangoproject.com/en/4.1/topics/i18n/

LANGUAGE_CODE = 'ru-ru'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_TZ = True

DATETIME_FORMAT = 'd.m.Y H:i'

USE_L10N = False


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/4.1/howto/static-files/

STATIC_URL = 'static/'

STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'static/'),
]

# Default primary key field type
# https://docs.djangoproject.com/en/4.1/ref/settings/#default-auto-field

DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'


# More settings by ForestWork

RESULTS_PER_PAGE = 10

LOGIN_URL = '/users/login'
LOGIN_REDIRECT_URL = '/'
LOGOUT_REDIRECT_URL = '/'
25 changes: 25 additions & 0 deletions forestwork/forestwork/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
"""forestwork URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/4.1/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path, include

urlpatterns = [
path('', include('main.urls')),
path('jobs/', include('jobs.urls')),
path('users/', include('users.urls')),
path('profile/', include('user_profile.urls')),
path('admin/', admin.site.urls),
]
16 changes: 16 additions & 0 deletions forestwork/forestwork/wsgi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""
WSGI config for forestwork project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/4.1/howto/deployment/wsgi/
"""

import os

from django.core.wsgi import get_wsgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'forestwork.settings')

application = get_wsgi_application()
Empty file added forestwork/jobs/__init__.py
Empty file.
10 changes: 10 additions & 0 deletions forestwork/jobs/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from django.contrib import admin
from .models import Job


# Register your models here.
@admin.register(Job)
class Job(admin.ModelAdmin):
list_display = ('title', 'user', 'salary', 'date_publish')
list_filter = ('salary', 'date_publish')
readonly_fields = ('date_publish',)
7 changes: 7 additions & 0 deletions forestwork/jobs/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from django.apps import AppConfig


class JobsConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'jobs'
verbose_name = '袙邪泻邪薪褋懈懈'
Loading

0 comments on commit 42cc071

Please sign in to comment.