<commit_before># coding:utf-8

from os import environ, path

from webob import Response
from webob.dec import wsgify
from webob.static import DirectoryApp


@wsgify
def api(request):
    """WSGI-приложение"""
    return Response('Hello!')


# Приложение, раздающее статику
static_serving_app = DirectoryApp(
    path.join(environ['BUP_PATH'], 'static', 'barsup'),
    index_page='index.html',
    hide_index_with_redirect=True
)


@wsgify.middleware
def serve_static(request, app):
    # url = request.path
    # if url == '/' or (
    #     url.startswith('/index') or
    #     url.startswith('/static/')
    # ):
    #     return static_serving_app
    # else:
    #     return app
    res = request.call_application(static_serving_app)
    if res[0] != '200 OK':
        return app
    else:
        return static_serving_app


application = serve_static(api)<commit_msg>Временная возможность загрузки страниц через url - http://localhost:8000/barsup/index.html<commit_after># coding:utf-8

from os import environ, path

from webob import Response
from webob.dec import wsgify
from webob.static import DirectoryApp


@wsgify
def api(request):
    """WSGI-приложение"""
    return Response('Hello!')


# Приложение, раздающее статику
static_serving_app = DirectoryApp(
    path.join(environ['BUP_PATH'], 'static'),
    index_page='barsup/',
    hide_index_with_redirect=False
)


@wsgify.middleware
def serve_static(request, app):
    url = request.path
    if url == '/' or (
        url.startswith('/barsup')
    ):
        return static_serving_app
    else:
        return app
    # res = request.call_application(static_serving_app)
    # if res[0] != '200 OK':
    #     return app
    # else:
    #     return static_serving_app


application = serve_static(api)
{'fraction_non_alphanumeric': 0.113431151241535, 'fraction_numerical': 0.007900677200902935, 'mean_word_length': 3.3777777777777778, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1830821', 'n_tokens_mistral': 609, 'n_tokens_neox': 601, 'n_words': 132}