Skip to main content

We like writing short codes but we don"t want to think about logic. Here with django-arg-path package you can write short and clean code easily

Project description

This package helps you write shorter and cleaner codes by supporting the useage of one views with multiple urls in django. These urls and views are static but supports any extra dynamic slug, str, int etc.

Useage is simple

Here is our urls.py file

from django_arg_path import arg_path

urlpatterns = [
  arg_path('en', '', home, name='home_en',
  arg_path('ru', 'ru', home, name='home_ru',
  arg_path('es', 'es', home, name='home_es',
]

Here is our views.py file

def home(request, static_arg=''):
    # static_arg variable gives us en, ru and es as a string which we included in the beginning of our path
    return render(request, static_arg+'.html')

So this one views.py file creates 3 pages named '', 'ru' and 'es'

Something like that 127.0.0.1:8000/, 127.0.0.1:8000/ru, 127.0.0.1:8000/es,

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_arg_path-0.2.tar.gz (3.4 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page