Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Few more examples #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Few more examples #2

wants to merge 2 commits into from

Conversation

fruch
Copy link

@fruch fruch commented Mar 8, 2012

  • added support for star import (could shorten the code, on the expense of name space littering)
  • added an example that uses the Django ORM (couldn't find a way to do it in one file...)

@apendleton
Copy link
Owner

This is interesting, certainly... I think, though, that I'd like to figure out a way that gives access to models without requiring creating an explicit app. I want to play with it some more, this weekend, but I'm pretty sure that you could get there with the right hacky helper functions. I'm basically of the opinion that the helper library can be as ugly as necessary to keep the code that consumes it clean and compact.

This pull request provides a good starting place for that, though.

@fruch
Copy link
Author

fruch commented Mar 8, 2012

I've tried that for a hour or so... for some reason couldn't found a way to force django to create the tables.
tables are created per app, and there if theres no app, no tables are created.

I'm not sure it could be done without hacking into the django code.

one directory, and two files (one empty init.py) are quite reasonable for mini-framework
(I myself really like the Django app style, but I can see how Flask/CherryPy and other micro-frameworks can help)

I hope you'll be able to solve that.

BTW what do you think about the star import, I know some people really hate it.

@apendleton
Copy link
Owner

I have no objection to the star import, and I agree that it should be a supported pattern... that said, the names of the helpers will be relatively common names ("configure," "route," etc.), so I definitely see the possibility for conflicts, and I don't have any interest in changing the names of the helpers (to "djroute" or something) to make that less likely, so if I ever use this thing in production, I probably personally won't use it that way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants