limdauto / drf_openapi

[DEPRECATED] Beautiful Django Rest Framework API documentation autogeneration through OpenAPI standard

Home Page:https://drf-openapi.readthedocs.io/en/latest/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

String with 'f' prefix not work with python2.7 by run examples

howmp opened this issue · comments

commented
  • DRF OpenAPI version: 1.0.0
  • Python version: 2.7.11
  • Operating System: windows

Description

urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(f'{API_PREFIX}/schema/', MySchemaView.as_view(), name='api_schema'),
    url(f'{API_PREFIX}/snippets/', include('snippets.urls')),
]

String with 'f' prefix not work in python2.7

What I Did

python examples/manage.py runserver

f strings were added in Python3.6.
While f strings are really nice I think the best thing to update the docs to change these to raw strings instead.

@howmp would you be interested in submitting a PR updating it to raw regex in the docs?

+1, does not work with Python 2.7