Skip to content

Commit 35fc65a

Browse files
committed
bot release
0 parents  commit 35fc65a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1722
-0
lines changed

Procfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
web: gunicorn mybot.wsgi --log-file -

manage.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env python
2+
"""Django's command-line utility for administrative tasks."""
3+
import os
4+
import sys
5+
6+
7+
def main():
8+
"""Run administrative tasks."""
9+
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mybot.settings')
10+
try:
11+
from django.core.management import execute_from_command_line
12+
except ImportError as exc:
13+
raise ImportError(
14+
"Couldn't import Django. Are you sure it's installed and "
15+
"available on your PYTHONPATH environment variable? Did you "
16+
"forget to activate a virtual environment?"
17+
) from exc
18+
execute_from_command_line(sys.argv)
19+
20+
21+
if __name__ == '__main__':
22+
main()

mybot/__init__.py

Whitespace-only changes.

mybot/asgi.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
"""
2+
ASGI config for mybot project.
3+
4+
It exposes the ASGI callable as a module-level variable named ``application``.
5+
6+
For more information on this file, see
7+
https://docs.djangoproject.com/en/3.2/howto/deployment/asgi/
8+
"""
9+
10+
import os
11+
12+
from django.core.asgi import get_asgi_application
13+
14+
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mybot.settings')
15+
16+
application = get_asgi_application()

mybot/settings.py

Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
"""
2+
Django settings for mybot project.
3+
4+
Generated by 'django-admin startproject' using Django 3.2.6.
5+
6+
For more information on this file, see
7+
https://docs.djangoproject.com/en/3.2/topics/settings/
8+
9+
For the full list of settings and their values, see
10+
https://docs.djangoproject.com/en/3.2/ref/settings/
11+
"""
12+
13+
import os
14+
from pathlib import Path
15+
16+
import dj_database_url
17+
18+
19+
# Build paths inside the project like this: BASE_DIR / 'subdir'.
20+
BASE_DIR = Path(__file__).resolve().parent.parent
21+
22+
23+
# Quick-start development settings - unsuitable for production
24+
# See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/
25+
26+
# SECURITY WARNING: keep the secret key used in production secret!
27+
SECRET_KEY = os.environ.get("DJANGO_SECRET_KEY", 'SOME_KIND_OF_KEY')
28+
29+
# SECURITY WARNING: don't run with debug turned on in production!
30+
DEBUG = os.environ.get("DJANGO_DEBUG", True) != "False"
31+
32+
ALLOWED_HOSTS = ['mipt-faltbot.herokuapp.com', '127.0.0.1']
33+
34+
35+
# Application definition
36+
37+
INSTALLED_APPS = [
38+
'django.contrib.admin',
39+
'django.contrib.auth',
40+
'django.contrib.contenttypes',
41+
'django.contrib.sessions',
42+
'django.contrib.messages',
43+
'django.contrib.staticfiles',
44+
'vk_bot.apps.VkBotConfig',
45+
]
46+
47+
MIDDLEWARE = [
48+
'django.middleware.security.SecurityMiddleware',
49+
'whitenoise.middleware.WhiteNoiseMiddleware',
50+
'django.contrib.sessions.middleware.SessionMiddleware',
51+
'django.middleware.common.CommonMiddleware',
52+
'django.middleware.csrf.CsrfViewMiddleware',
53+
'django.contrib.auth.middleware.AuthenticationMiddleware',
54+
'django.contrib.messages.middleware.MessageMiddleware',
55+
'django.middleware.clickjacking.XFrameOptionsMiddleware',
56+
]
57+
58+
ROOT_URLCONF = 'mybot.urls'
59+
60+
TEMPLATES = [
61+
{
62+
'BACKEND': 'django.template.backends.django.DjangoTemplates',
63+
'DIRS': [BASE_DIR / 'templates']
64+
,
65+
'APP_DIRS': True,
66+
'OPTIONS': {
67+
'context_processors': [
68+
'django.template.context_processors.debug',
69+
'django.template.context_processors.request',
70+
'django.contrib.auth.context_processors.auth',
71+
'django.contrib.messages.context_processors.messages',
72+
],
73+
},
74+
},
75+
]
76+
77+
WSGI_APPLICATION = 'mybot.wsgi.application'
78+
79+
80+
# Database
81+
# https://docs.djangoproject.com/en/3.2/ref/settings/#databases
82+
83+
DATABASES = {
84+
'default': {
85+
'ENGINE': 'django.db.backends.sqlite3',
86+
'NAME': BASE_DIR / 'db.sqlite3',
87+
}
88+
}
89+
90+
# Heroku: Update database configuration from $DATABASE_URL.
91+
db_from_env = dj_database_url.config(conn_max_age=500)
92+
DATABASES['default'].update(db_from_env)
93+
94+
95+
# Password validation
96+
# https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators
97+
98+
AUTH_PASSWORD_VALIDATORS = [
99+
{
100+
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
101+
},
102+
{
103+
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
104+
},
105+
{
106+
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
107+
},
108+
{
109+
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
110+
},
111+
]
112+
113+
114+
# Internationalization
115+
# https://docs.djangoproject.com/en/3.2/topics/i18n/
116+
117+
LANGUAGE_CODE = 'en-us'
118+
119+
TIME_ZONE = 'Europe/Moscow'
120+
121+
USE_I18N = True
122+
123+
USE_L10N = True
124+
125+
USE_TZ = True
126+
127+
128+
# Static files (CSS, JavaScript, Images)
129+
# https://docs.djangoproject.com/en/3.2/howto/static-files/
130+
131+
132+
# The absolute path to the directory where collectstatic will collect static files for deployment.
133+
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
134+
135+
# The URL to use when referring to static files (where they will be served from)
136+
STATIC_URL = '/static/'
137+
138+
# Default primary key field type
139+
# https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field
140+
141+
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
142+
143+
# Simplified static file serving.
144+
# https://warehouse.python.org/project/whitenoise/
145+
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
146+
147+
148+
# VK Callback API Settings
149+
VK_SECRET_KEY = os.environ.get("VK_SECRET_KEY", "YOUR_SECRET_KEY")
150+
ACCESS_TOKEN = os.environ.get("ACCESS_TOKEN", "YOUR_ACCESS_TOKEN")
151+
VK_CONFIRMATION_CODE = os.environ.get("VK_CONFIRMATION_CODE", "YOUR_CONFIRMATION_CODE")
152+
API_VERSION = 5.131
153+
154+
155+
# VK Keyboard settings
156+
MAX_BUTTONS_ON_LINE = 5
157+
MAX_INLINE_LINES = 6
158+
MAX_DEFAULT_LINES = 10
159+
160+
161+
# Response settings
162+
SCHEDULE_ENABLED = os.environ.get("SCHEDULE_ENABLED", False) == 'True'
163+
LINKS_ENABLED = os.environ.get("LINKS_ENABLED", False) == 'True'
164+
165+
VK_ADMIN_ID = 174445151
166+
GROUP_ID = 202550577
167+
168+
169+

mybot/urls.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
"""mybot URL Configuration
2+
3+
The `urlpatterns` list routes URLs to views. For more information please see:
4+
https://docs.djangoproject.com/en/3.2/topics/http/urls/
5+
Examples:
6+
Function views
7+
1. Add an import: from my_app import views
8+
2. Add a URL to urlpatterns: path('', views.home, name='home')
9+
Class-based views
10+
1. Add an import: from other_app.views import Home
11+
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
12+
Including another URLconf
13+
1. Import the include() function: from django.urls import include, path
14+
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
15+
"""
16+
from django.contrib import admin
17+
from django.urls import path
18+
from django.urls import include
19+
from django.conf.urls.static import static
20+
from django.conf import settings
21+
from django.views.generic import RedirectView
22+
23+
urlpatterns = [
24+
path('admin/', admin.site.urls),
25+
path('vk_bot/', include('vk_bot.urls')),
26+
path('', RedirectView.as_view(url='/admin/', permanent=True)),
27+
] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)

mybot/wsgi.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
"""
2+
WSGI config for mybot project.
3+
4+
It exposes the WSGI callable as a module-level variable named ``application``.
5+
6+
For more information on this file, see
7+
https://docs.djangoproject.com/en/3.2/howto/deployment/wsgi/
8+
"""
9+
10+
import os
11+
12+
from django.core.wsgi import get_wsgi_application
13+
14+
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mybot.settings')
15+
16+
application = get_wsgi_application()

requirements.txt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
asgiref==3.4.1
2+
certifi==2021.5.30
3+
charset-normalizer==2.0.4
4+
dj-database-url==0.5.0
5+
Django==3.2.6
6+
et-xmlfile==1.1.0
7+
gunicorn==20.1.0
8+
idna==3.2
9+
numpy==1.21.1
10+
openpyxl==3.0.7
11+
pandas==1.3.1
12+
psycopg2==2.9.1
13+
python-dateutil==2.8.2
14+
pytz==2021.1
15+
requests==2.26.0
16+
six==1.16.0
17+
sqlparse==0.4.1
18+
urllib3==1.26.6
19+
vk==2.0.2
20+
whitenoise==5.3.0

runtime.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
python-3.9.6

vk_bot/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)