drf_openapi icon indicating copy to clipboard operation
drf_openapi copied to clipboard

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

Open howmp opened this issue 7 years ago • 2 comments

  • 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

howmp avatar Dec 01 '17 11:12 howmp

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?

werwty avatar Dec 14 '17 20:12 werwty

+1, does not work with Python 2.7

seansisson avatar Jan 04 '18 19:01 seansisson