├── telegram_bot ├── __init__.py ├── asgi.py ├── wsgi.py ├── urls.py └── settings.py ├── telegram_config ├── __init__.py ├── data │ ├── __init__.py │ └── config.py ├── states │ └── __init__.py ├── handlers │ ├── groups │ │ └── __init__.py │ ├── channels │ │ └── __init__.py │ ├── errors │ │ ├── __init__.py │ │ └── error_handler.py │ ├── __init__.py │ └── users │ │ ├── __init__.py │ │ ├── echo.py │ │ ├── start.py │ │ └── help.py ├── utils │ ├── db_api │ │ └── __init__.py │ ├── redis │ │ ├── __init__.py │ │ └── consts.py │ ├── misc │ │ ├── __init__.py │ │ ├── logging.py │ │ └── throttling.py │ ├── __init__.py │ └── notify_admins.py ├── keyboards │ ├── default │ │ └── __init__.py │ ├── inline │ │ └── __init__.py │ └── __init__.py ├── middlewares │ ├── __init__.py │ └── throttling.py ├── filters │ └── __init__.py └── loader.py ├── profile ├── management │ ├── __init__.py │ └── commands │ │ ├── __init__.py │ │ └── bot.py ├── migrations │ └── __init__.py ├── __init__.py ├── models.py ├── tests.py ├── admin.py ├── views.py └── apps.py ├── requirements.txt ├── manage.py ├── README.md └── .gitignore /telegram_bot/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /telegram_config/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /profile/management/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /profile/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /telegram_config/data/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /telegram_config/states/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /profile/management/commands/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /telegram_config/handlers/groups/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /telegram_config/utils/db_api/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /telegram_config/utils/redis/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /telegram_config/handlers/channels/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /telegram_config/keyboards/default/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /telegram_config/keyboards/inline/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /profile/__init__.py: -------------------------------------------------------------------------------- 1 | default_app_config = 'profile.apps.ProfileConfig' -------------------------------------------------------------------------------- /profile/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | -------------------------------------------------------------------------------- /profile/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /profile/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /profile/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render 2 | 3 | # Create your views here. 4 | -------------------------------------------------------------------------------- /telegram_config/keyboards/__init__.py: -------------------------------------------------------------------------------- 1 | from . import default 2 | from . import inline 3 | -------------------------------------------------------------------------------- /telegram_config/handlers/errors/__init__.py: -------------------------------------------------------------------------------- 1 | from .error_handler import dp 2 | 3 | __all__ = ["dp"] 4 | -------------------------------------------------------------------------------- /telegram_config/utils/misc/__init__.py: -------------------------------------------------------------------------------- 1 | from .throttling import rate_limit 2 | from . import logging 3 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | aiogram==2.9.2 2 | aiohttp==3.6.2 3 | aioredis==1.3.1 4 | django==3.1 5 | #python-dotenv 6 | -------------------------------------------------------------------------------- /telegram_config/handlers/__init__.py: -------------------------------------------------------------------------------- 1 | from .errors import dp 2 | from .users import dp 3 | 4 | __all__ = ["dp"] 5 | -------------------------------------------------------------------------------- /profile/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class ProfileConfig(AppConfig): 5 | name = 'profile' 6 | -------------------------------------------------------------------------------- /telegram_config/handlers/users/__init__.py: -------------------------------------------------------------------------------- 1 | from .help import dp 2 | from .start import dp 3 | from .echo import dp 4 | 5 | __all__ = ["dp"] 6 | -------------------------------------------------------------------------------- /telegram_config/utils/__init__.py: -------------------------------------------------------------------------------- 1 | from . import db_api 2 | from . import misc 3 | from . import redis 4 | from .notify_admins import on_startup_notify 5 | -------------------------------------------------------------------------------- /telegram_config/middlewares/__init__.py: -------------------------------------------------------------------------------- 1 | from aiogram import Dispatcher 2 | 3 | from .throttling import ThrottlingMiddleware 4 | 5 | 6 | def setup(dp: Dispatcher): 7 | dp.middleware.setup(ThrottlingMiddleware()) 8 | -------------------------------------------------------------------------------- /telegram_config/filters/__init__.py: -------------------------------------------------------------------------------- 1 | from aiogram import Dispatcher 2 | 3 | 4 | # from .is_admin import AdminFilter 5 | 6 | 7 | def setup(dp: Dispatcher): 8 | # dp.filters_factory.bind(AdminFilter) 9 | pass 10 | -------------------------------------------------------------------------------- /telegram_config/handlers/users/echo.py: -------------------------------------------------------------------------------- 1 | from aiogram import types 2 | from telegram_config.loader import dp 3 | 4 | 5 | @dp.message_handler() 6 | async def bot_echo(message: types.Message): 7 | await message.answer(message.text) 8 | -------------------------------------------------------------------------------- /telegram_config/utils/misc/logging.py: -------------------------------------------------------------------------------- 1 | import logging 2 | 3 | logging.basicConfig(format=u'%(filename)s [LINE:%(lineno)d] #%(levelname)-8s [%(asctime)s] %(message)s', 4 | level=logging.INFO, 5 | # level=logging.DEBUG, 6 | ) 7 | -------------------------------------------------------------------------------- /telegram_config/loader.py: -------------------------------------------------------------------------------- 1 | from aiogram import Bot, Dispatcher, types 2 | from aiogram.contrib.fsm_storage.memory import MemoryStorage 3 | 4 | from .data import config 5 | 6 | bot = Bot(token=config.BOT_TOKEN, parse_mode=types.ParseMode.HTML) 7 | storage = MemoryStorage() 8 | dp = Dispatcher(bot, storage=storage) 9 | -------------------------------------------------------------------------------- /telegram_config/handlers/users/start.py: -------------------------------------------------------------------------------- 1 | from aiogram import types 2 | from aiogram.dispatcher.filters.builtin import CommandStart 3 | 4 | from telegram_config.loader import dp 5 | 6 | 7 | @dp.message_handler(CommandStart()) 8 | async def bot_start(message: types.Message): 9 | await message.answer(f'Привет, {message.from_user.full_name}!') 10 | -------------------------------------------------------------------------------- /telegram_config/utils/notify_admins.py: -------------------------------------------------------------------------------- 1 | import logging 2 | 3 | from aiogram import Dispatcher 4 | 5 | from telegram_config.data.config import admins 6 | 7 | 8 | async def on_startup_notify(dp: Dispatcher): 9 | for admin in admins: 10 | try: 11 | await dp.bot.send_message(admin, "Бот Запущен") 12 | 13 | except Exception as err: 14 | logging.exception(err) 15 | -------------------------------------------------------------------------------- /telegram_config/data/config.py: -------------------------------------------------------------------------------- 1 | import os 2 | from django.conf import settings 3 | 4 | # from dotenv import load_dotenv 5 | # 6 | # load_dotenv() 7 | 8 | BOT_TOKEN = settings.BOT_TOKEN 9 | 10 | admins = [ 11 | settings.ADMIN_ID, 12 | ] 13 | 14 | ip = settings.IP 15 | 16 | aiogram_redis = { 17 | 'host': ip, 18 | } 19 | 20 | redis = { 21 | 'address': (ip, 6379), 22 | 'encoding': 'utf8' 23 | } 24 | -------------------------------------------------------------------------------- /telegram_config/utils/redis/consts.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | from typing import Optional 3 | 4 | import aioredis 5 | 6 | from data import config 7 | 8 | data_pool: Optional[aioredis.Redis] = None 9 | 10 | 11 | async def create_pools(): 12 | global data_pool 13 | data_pool = await aioredis.create_redis_pool(**config.redis, db=1) 14 | 15 | 16 | asyncio.get_event_loop().run_until_complete(create_pools()) 17 | -------------------------------------------------------------------------------- /telegram_config/utils/misc/throttling.py: -------------------------------------------------------------------------------- 1 | def rate_limit(limit: int, key=None): 2 | """ 3 | Decorator for configuring rate limit and key in different functions. 4 | 5 | :param limit: 6 | :param key: 7 | :return: 8 | """ 9 | 10 | def decorator(func): 11 | setattr(func, 'throttling_rate_limit', limit) 12 | if key: 13 | setattr(func, 'throttling_key', key) 14 | return func 15 | 16 | return decorator 17 | -------------------------------------------------------------------------------- /telegram_bot/asgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | ASGI config for telegram_bot 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.1/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', 'telegram_bot.settings') 15 | 16 | application = get_asgi_application() 17 | -------------------------------------------------------------------------------- /telegram_bot/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for telegram_bot 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.1/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', 'telegram_bot.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /telegram_config/handlers/users/help.py: -------------------------------------------------------------------------------- 1 | from aiogram import types 2 | from aiogram.dispatcher.filters.builtin import CommandHelp 3 | 4 | from telegram_config.loader import dp 5 | from telegram_config.utils.misc import rate_limit 6 | 7 | 8 | @rate_limit(5, 'help') 9 | @dp.message_handler(CommandHelp()) 10 | async def bot_help(message: types.Message): 11 | text = [ 12 | 'Список команд: ', 13 | '/start - Начать диалог', 14 | '/help - Получить справку' 15 | ] 16 | await message.answer('\n'.join(text)) 17 | -------------------------------------------------------------------------------- /profile/management/commands/bot.py: -------------------------------------------------------------------------------- 1 | from django.core.management.base import BaseCommand 2 | 3 | 4 | async def on_startup(dp): 5 | import telegram_config.filters 6 | import telegram_config.middlewares 7 | telegram_config.filters.setup(dp) 8 | telegram_config.middlewares.setup(dp) 9 | 10 | from telegram_config.utils.notify_admins import on_startup_notify 11 | await on_startup_notify(dp) 12 | 13 | 14 | class Command(BaseCommand): 15 | help = 'Телеграм бот' 16 | 17 | def handle(self, *args, **options): 18 | from aiogram import executor 19 | from telegram_config.handlers import dp 20 | 21 | executor.start_polling(dp, on_startup=on_startup) -------------------------------------------------------------------------------- /manage.py: -------------------------------------------------------------------------------- 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', 'telegram_bot.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() 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Предварительные настройки 2 | --- 3 | - Создать файл local_settings.py с настройками: 4 | 5 | ```python 6 | SECRET_KEY = '' 7 | 8 | DEBUG = True 9 | 10 | ALLOWED_HOSTS = [] 11 | 12 | 13 | DATABASES = { 14 | 'default': { 15 | 'ENGINE': 'django.db.backends.postgresql_psycopg2', 16 | 'NAME': 'название базы', 17 | 'USER': 'имя пользователь', 18 | 'PASSWORD': 'пароль пользователя', 19 | 'HOST': 'localhost', 20 | 'PORT': '5432', 21 | } 22 | } 23 | 24 | ### Настройки бота 25 | BOT_TOKEN = 'полученный токен от BotFather' 26 | ADMIN_ID = посмотреть id можно с помощью @ShowJsonBot 27 | IP = "localhost" 28 | ``` 29 | - Создать файл prod_settings.py: 30 | 31 | Запуск бота 32 | --- 33 | ```python 34 | python manage.py bot 35 | ``` -------------------------------------------------------------------------------- /telegram_bot/urls.py: -------------------------------------------------------------------------------- 1 | """telegram_bot URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/3.1/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 | 19 | urlpatterns = [ 20 | path('admin/', admin.site.urls), 21 | ] 22 | -------------------------------------------------------------------------------- /telegram_config/middlewares/throttling.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | 3 | from aiogram import types, Dispatcher 4 | from aiogram.dispatcher import DEFAULT_RATE_LIMIT 5 | from aiogram.dispatcher.handler import CancelHandler, current_handler 6 | from aiogram.dispatcher.middlewares import BaseMiddleware 7 | from aiogram.utils.exceptions import Throttled 8 | 9 | 10 | class ThrottlingMiddleware(BaseMiddleware): 11 | """ 12 | Simple middleware 13 | """ 14 | 15 | def __init__(self, limit=DEFAULT_RATE_LIMIT, key_prefix='antiflood_'): 16 | self.rate_limit = limit 17 | self.prefix = key_prefix 18 | super(ThrottlingMiddleware, self).__init__() 19 | 20 | async def on_process_message(self, message: types.Message, data: dict): 21 | handler = current_handler.get() 22 | dispatcher = Dispatcher.get_current() 23 | if handler: 24 | limit = getattr(handler, 'throttling_rate_limit', self.rate_limit) 25 | key = getattr(handler, 'throttling_key', f"{self.prefix}_{handler.__name__}") 26 | else: 27 | limit = self.rate_limit 28 | key = f"{self.prefix}_message" 29 | try: 30 | await dispatcher.throttle(key, rate=limit) 31 | except Throttled as t: 32 | await self.message_throttled(message, t) 33 | raise CancelHandler() 34 | 35 | async def message_throttled(self, message: types.Message, throttled: Throttled): 36 | handler = current_handler.get() 37 | dispatcher = Dispatcher.get_current() 38 | if handler: 39 | key = getattr(handler, 'throttling_key', f"{self.prefix}_{handler.__name__}") 40 | else: 41 | key = f"{self.prefix}_message" 42 | delta = throttled.rate - throttled.delta 43 | if throttled.exceeded_count <= 2: 44 | await message.reply('Too many requests! ') 45 | await asyncio.sleep(delta) 46 | thr = await dispatcher.check_key(key) 47 | if thr.exceeded_count == throttled.exceeded_count: 48 | await message.reply('Unlocked.') 49 | -------------------------------------------------------------------------------- /telegram_config/handlers/errors/error_handler.py: -------------------------------------------------------------------------------- 1 | import logging 2 | 3 | from telegram_config.loader import dp 4 | 5 | 6 | @dp.errors_handler() 7 | async def errors_handler(update, exception): 8 | """ 9 | Exceptions handler. Catches all exceptions within task factory tasks. 10 | :param dispatcher: 11 | :param update: 12 | :param exception: 13 | :return: stdout logging 14 | """ 15 | from aiogram.utils.exceptions import (Unauthorized, InvalidQueryID, TelegramAPIError, 16 | CantDemoteChatCreator, MessageNotModified, MessageToDeleteNotFound, 17 | MessageTextIsEmpty, RetryAfter, 18 | CantParseEntities, MessageCantBeDeleted) 19 | 20 | if isinstance(exception, CantDemoteChatCreator): 21 | logging.debug("Can't demote chat creator") 22 | return True 23 | 24 | if isinstance(exception, MessageNotModified): 25 | logging.debug('Message is not modified') 26 | return True 27 | if isinstance(exception, MessageCantBeDeleted): 28 | logging.debug('Message cant be deleted') 29 | return True 30 | 31 | if isinstance(exception, MessageToDeleteNotFound): 32 | logging.debug('Message to delete not found') 33 | return True 34 | 35 | if isinstance(exception, MessageTextIsEmpty): 36 | logging.debug('MessageTextIsEmpty') 37 | return True 38 | 39 | if isinstance(exception, Unauthorized): 40 | logging.info(f'Unauthorized: {exception}') 41 | return True 42 | 43 | if isinstance(exception, InvalidQueryID): 44 | logging.exception(f'InvalidQueryID: {exception} \nUpdate: {update}') 45 | return True 46 | 47 | if isinstance(exception, TelegramAPIError): 48 | logging.exception(f'TelegramAPIError: {exception} \nUpdate: {update}') 49 | return True 50 | if isinstance(exception, RetryAfter): 51 | logging.exception(f'RetryAfter: {exception} \nUpdate: {update}') 52 | return True 53 | if isinstance(exception, CantParseEntities): 54 | logging.exception(f'CantParseEntities: {exception} \nUpdate: {update}') 55 | return True 56 | logging.exception(f'Update: {update} \n{exception}') 57 | -------------------------------------------------------------------------------- /telegram_bot/settings.py: -------------------------------------------------------------------------------- 1 | """ 2 | Django settings for telegram_bot project. 3 | 4 | Generated by 'django-admin startproject' using Django 3.1. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/3.1/topics/settings/ 8 | 9 | For the full list of settings and their values, see 10 | https://docs.djangoproject.com/en/3.1/ref/settings/ 11 | """ 12 | import os 13 | from pathlib import Path 14 | 15 | # Build paths inside the project like this: BASE_DIR / 'subdir'. 16 | BASE_DIR = Path(__file__).resolve(strict=True).parent.parent 17 | 18 | 19 | # Quick-start development settings - unsuitable for production 20 | # See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/ 21 | 22 | 23 | # Application definition 24 | 25 | INSTALLED_APPS = [ 26 | 'django.contrib.admin', 27 | 'django.contrib.auth', 28 | 'django.contrib.contenttypes', 29 | 'django.contrib.sessions', 30 | 'django.contrib.messages', 31 | 'django.contrib.staticfiles', 32 | 33 | 'profile' 34 | ] 35 | 36 | MIDDLEWARE = [ 37 | 'django.middleware.security.SecurityMiddleware', 38 | 'django.contrib.sessions.middleware.SessionMiddleware', 39 | 'django.middleware.common.CommonMiddleware', 40 | 'django.middleware.csrf.CsrfViewMiddleware', 41 | 'django.contrib.auth.middleware.AuthenticationMiddleware', 42 | 'django.contrib.messages.middleware.MessageMiddleware', 43 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', 44 | ] 45 | 46 | ROOT_URLCONF = 'telegram_bot.urls' 47 | 48 | TEMPLATES = [ 49 | { 50 | 'BACKEND': 'django.template.backends.django.DjangoTemplates', 51 | 'DIRS': [os.path.join(BASE_DIR, 'templates')] 52 | , 53 | 'APP_DIRS': True, 54 | 'OPTIONS': { 55 | 'context_processors': [ 56 | 'django.template.context_processors.debug', 57 | 'django.template.context_processors.request', 58 | 'django.contrib.auth.context_processors.auth', 59 | 'django.contrib.messages.context_processors.messages', 60 | ], 61 | }, 62 | }, 63 | ] 64 | 65 | WSGI_APPLICATION = 'telegram_bot.wsgi.application' 66 | 67 | 68 | # Password validation 69 | # https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators 70 | 71 | AUTH_PASSWORD_VALIDATORS = [ 72 | { 73 | 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', 74 | }, 75 | { 76 | 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', 77 | }, 78 | { 79 | 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', 80 | }, 81 | { 82 | 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', 83 | }, 84 | ] 85 | 86 | 87 | # Internationalization 88 | # https://docs.djangoproject.com/en/3.1/topics/i18n/ 89 | 90 | LANGUAGE_CODE = 'ru-Ru' 91 | 92 | TIME_ZONE = 'Europe/Moscow' 93 | 94 | USE_I18N = True 95 | 96 | USE_L10N = True 97 | 98 | USE_TZ = True 99 | 100 | 101 | # Static files (CSS, JavaScript, Images) 102 | # https://docs.djangoproject.com/en/3.1/howto/static-files/ 103 | 104 | STATIC_URL = '/static/' 105 | 106 | try: 107 | from .local_settings import * 108 | except: 109 | from .prod_settings import * 110 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | # Created by https://www.toptal.com/developers/gitignore/api/pycharm,macos,django 6 | # Edit at https://www.toptal.com/developers/gitignore?templates=pycharm,macos,django 7 | 8 | ### Django ### 9 | *.log 10 | *.pot 11 | *.pyc 12 | __pycache__/ 13 | local_settings.py 14 | prod_settings.py 15 | db.sqlite3 16 | db.sqlite3-journal 17 | media 18 | 19 | # If your build process includes running collectstatic, then you probably don't need or want to include staticfiles/ 20 | # in your Git repository. Update and uncomment the following line accordingly. 21 | # /staticfiles/ 22 | 23 | ### Django.Python Stack ### 24 | # Byte-compiled / optimized / DLL files 25 | *.py[cod] 26 | *$py.class 27 | 28 | # C extensions 29 | *.so 30 | 31 | # Distribution / packaging 32 | .Python 33 | build/ 34 | develop-eggs/ 35 | dist/ 36 | downloads/ 37 | eggs/ 38 | .eggs/ 39 | lib/ 40 | lib64/ 41 | parts/ 42 | sdist/ 43 | var/ 44 | wheels/ 45 | pip-wheel-metadata/ 46 | share/python-wheels/ 47 | *.egg-info/ 48 | .installed.cfg 49 | *.egg 50 | MANIFEST 51 | 52 | # PyInstaller 53 | # Usually these files are written by a python script from a template 54 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 55 | *.manifest 56 | *.spec 57 | 58 | # Installer logs 59 | pip-log.txt 60 | pip-delete-this-directory.txt 61 | 62 | # Unit test / coverage reports 63 | htmlcov/ 64 | .tox/ 65 | .nox/ 66 | .coverage 67 | .coverage.* 68 | .cache 69 | nosetests.xml 70 | coverage.xml 71 | *.cover 72 | *.py,cover 73 | .hypothesis/ 74 | .pytest_cache/ 75 | pytestdebug.log 76 | 77 | # Translations 78 | *.mo 79 | 80 | # Django stuff: 81 | 82 | # Flask stuff: 83 | instance/ 84 | .webassets-cache 85 | 86 | # Scrapy stuff: 87 | .scrapy 88 | 89 | # Sphinx documentation 90 | docs/_build/ 91 | doc/_build/ 92 | 93 | # PyBuilder 94 | target/ 95 | 96 | # Jupyter Notebook 97 | .ipynb_checkpoints 98 | 99 | # IPython 100 | profile_default/ 101 | ipython_config.py 102 | 103 | # pyenv 104 | .python-version 105 | 106 | # pipenv 107 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 108 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 109 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 110 | # install all needed dependencies. 111 | #Pipfile.lock 112 | 113 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow 114 | __pypackages__/ 115 | 116 | # Celery stuff 117 | celerybeat-schedule 118 | celerybeat.pid 119 | 120 | # SageMath parsed files 121 | *.sage.py 122 | 123 | # Environments 124 | .env 125 | .venv 126 | env/ 127 | venv/ 128 | ENV/ 129 | env.bak/ 130 | venv.bak/ 131 | 132 | # Spyder project settings 133 | .spyderproject 134 | .spyproject 135 | 136 | # Rope project settings 137 | .ropeproject 138 | 139 | # mkdocs documentation 140 | /site 141 | 142 | # mypy 143 | .mypy_cache/ 144 | .dmypy.json 145 | dmypy.json 146 | 147 | # Pyre type checker 148 | .pyre/ 149 | 150 | # pytype static type analyzer 151 | .pytype/ 152 | 153 | ### macOS ### 154 | # General 155 | .DS_Store 156 | .AppleDouble 157 | .LSOverride 158 | 159 | # Icon must end with two \r 160 | Icon 161 | 162 | # Thumbnails 163 | ._* 164 | 165 | # Files that might appear in the root of a volume 166 | .DocumentRevisions-V100 167 | .fseventsd 168 | .Spotlight-V100 169 | .TemporaryItems 170 | .Trashes 171 | .VolumeIcon.icns 172 | .com.apple.timemachine.donotpresent 173 | 174 | # Directories potentially created on remote AFP share 175 | .AppleDB 176 | .AppleDesktop 177 | Network Trash Folder 178 | Temporary Items 179 | .apdisk 180 | 181 | ### PyCharm ### 182 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider 183 | # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 184 | 185 | # User-specific stuff 186 | .idea/**/workspace.xml 187 | .idea/**/tasks.xml 188 | .idea/**/usage.statistics.xml 189 | .idea/**/dictionaries 190 | .idea/**/shelf 191 | 192 | # Generated files 193 | .idea/**/contentModel.xml 194 | 195 | # Sensitive or high-churn files 196 | .idea/**/dataSources/ 197 | .idea/**/dataSources.ids 198 | .idea/**/dataSources.local.xml 199 | .idea/**/sqlDataSources.xml 200 | .idea/**/dynamic.xml 201 | .idea/**/uiDesigner.xml 202 | .idea/**/dbnavigator.xml 203 | 204 | # Gradle 205 | .idea/**/gradle.xml 206 | .idea/**/libraries 207 | 208 | # Gradle and Maven with auto-import 209 | # When using Gradle or Maven with auto-import, you should exclude module files, 210 | # since they will be recreated, and may cause churn. Uncomment if using 211 | # auto-import. 212 | # .idea/artifacts 213 | # .idea/compiler.xml 214 | # .idea/jarRepositories.xml 215 | # .idea/modules.xml 216 | # .idea/*.iml 217 | # .idea/modules 218 | # *.iml 219 | # *.ipr 220 | 221 | # CMake 222 | cmake-build-*/ 223 | 224 | # Mongo Explorer plugin 225 | .idea/**/mongoSettings.xml 226 | 227 | # File-based project format 228 | *.iws 229 | 230 | # IntelliJ 231 | out/ 232 | 233 | # mpeltonen/sbt-idea plugin 234 | .idea_modules/ 235 | 236 | # JIRA plugin 237 | atlassian-ide-plugin.xml 238 | 239 | # Cursive Clojure plugin 240 | .idea/replstate.xml 241 | 242 | # Crashlytics plugin (for Android Studio and IntelliJ) 243 | com_crashlytics_export_strings.xml 244 | crashlytics.properties 245 | crashlytics-build.properties 246 | fabric.properties 247 | 248 | # Editor-based Rest Client 249 | .idea/httpRequests 250 | 251 | # Android studio 3.1+ serialized cache file 252 | .idea/caches/build_file_checksums.ser 253 | 254 | ### PyCharm Patch ### 255 | # Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721 256 | 257 | # *.iml 258 | # modules.xml 259 | # .idea/misc.xml 260 | # *.ipr 261 | 262 | # Sonarlint plugin 263 | # https://plugins.jetbrains.com/plugin/7973-sonarlint 264 | .idea/**/sonarlint/ 265 | 266 | # SonarQube Plugin 267 | # https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin 268 | .idea/**/sonarIssues.xml 269 | 270 | # Markdown Navigator plugin 271 | # https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced 272 | .idea/**/markdown-navigator.xml 273 | .idea/**/markdown-navigator-enh.xml 274 | .idea/**/markdown-navigator/ 275 | 276 | # Cache file creation bug 277 | # See https://youtrack.jetbrains.com/issue/JBR-2257 278 | .idea/$CACHE_FILE$ 279 | 280 | # CodeStream plugin 281 | # https://plugins.jetbrains.com/plugin/12206-codestream 282 | .idea/codestream.xml 283 | .idea/ 284 | 285 | # End of https://www.toptal.com/developers/gitignore/api/pycharm,macos,django --------------------------------------------------------------------------------