Skip to main content

django-fsu

Flask-Style URL Patterns for Django

Installation

pip install django-fsu

Usage

In urls.py: change your regex patterns to flask-styled paths.

from django.conf.urls import include
from django_fsu import url

from . import views

urlpatterns = [
    url('login', views.login),
    url('user/<username>', views.profile),
    url('article/<int:pk>', views.article),
    url('projects/', include('projects.urls'),
]

Variable parts in the route can be specified with angular brackets (user/<username>). By default a variable part in the URL accepts a string without a slash however a different format code can be specified as well by using <code:name>.

Variable parts are passed to the view function as keyword arguments. In the above example, views.profile will be passed with a keyword argument: username.

Currently supported formats codes are:

  • string (the default, accepts string without a slash)

  • int

  • float

  • uuid

  • path (accepts any string)

Please note that int and float variables are still passed to the view function as a string.

To see how individual functions work, see the docstrings or type help('django_fsu') in the interactive prompt.

Credits to: http://flask.pocoo.org/docs/latest/api/#url-route-registrations.

Metadata

Release files for django-fsu 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-fsu 0.1.2
File Size Uploaded Provenance Actions
django-fsu-0.1.2.tar.gz 2.5 kB Without provenance Details for django-fsu-0.1.2.tar.gz

Release files / django-fsu-0.1.2.tar.gz

Download URL django-fsu-0.1.2.tar.gz
Size 2.5 kB
Tags Source
SHA-256 checksum
How to use checksums
41f226fbfbe29e2880cd389309c8094def35fc3eb61ec51a286bd6dba9c4899a
BLAKE2b-256 checksum
How to use checksums
c79ae85cfce324164759a1190e756502e72b7c906308591aeec14f56e96343ec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for django-fsu 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page