Skip to content

fmarco/django-lite

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

django-lite

PyPI PyPI Latest Version PyPI

A simple lightweight version of Django

Why?

To make simple setup little web app or testing or simply to make some experiments with the framework.

Installation

pip install django-lite

Quickstart

from django_lite.django_lite import DjangoLite
from django_lite.utils char

app = DjangoLite(__file__)

@app.model()
class Sample(object):
    some_field = char(max_length=255)

    class Extra:
        base_url = r'^sample/'
        detail_view = r'detail/(?P<pk>\d+)/$'
        list_view = r'list/$'

if __name__ == '__main__':
    app.start()

Or explore 'example' folder!

Decorators (methods on class DjangoLite)

  • django_lite.django_lite.DjangoLite.route

    • arguments:
      • url_pattern: string / Regex for urlpattern
      • name: string (default=None) / view name
  • django_lite.django_lite.DjangoLite.model

    • arguments:
      • admin: boolean (default=True) / create an admin class for the created model
      • crud: boolean (default=False) / create a view for every CRUD operation

Commands

python path/to/file.py make_models ( > dest_file.py )

python path/to/file.py make_views ( > dest_file.py )

python path/to/file.py make_urls ( > dest_file.py )

python path/to/file.py make_settings ( > dest_file.py )

Tested versions

python 2.7 - django 1.11

TODOS

  • Add useful commands
  • Add some tests
  • Some refactoring ...

Feel free to contribute!