I've been working for a week on this idea of a generator for django
project. The goal is to provide a simple architecture that can be
after adapted to your project. The system is in alpha stage but allows
you to create project, model (+1 view and 1 form) and application.
Once your project is created you can download a tar.gz with the
complete project already build for you.
It's supposed to be used with the trunk version of django.
I plan to add permission, forms and view during the next 15 days. Let
me know if you have any advice or request.
The project can be found here: http://alpha.djangogenerator.com/ and
is open to registration
The source code is located on github: http://github.com/debrice/djangogenerator
All the best,
--
Brice Leroy
http://www.debrice.com
how is this different than `django-admin startproject` ?
Mike
--
Overconfidence breeds error when we take for granted that the game will
continue on its normal course; when we fail to provide for an unusually
powerful resource -- a check, a sacrifice, a stalemate. Afterwards the
victim may wail, `But who could have dreamt of such an idiotic-looking move?'
-- Fred Reinfeld, "The Complete Chess Course"
startproject almost = mkdir
This will generate your models, modelForm, views, templates, urls, and
soon customized forms and permissions
I'll add a copy project so you can extend an existing model if you
have a big production pace of common project model.
2010/2/9 Mike Ramirez <gufy...@gmail.com>:
That's what the web interface does?
Yes startproject gives you empty files so you can add in your own code, with
the minimal funs.
For me, I don't see your project as a big advantage, except maybe two minutes
of time where I don't need to do things like:
class MyModel(models.Model):
...
I don't know, thought about your approach before, but think it's reduntant.
Just because each project requires it's own data and model field attributes
and form funs... And I think django already does a great job of genericizing
this stuff with the code i.e. ModelFoms. I don't know how much of a real
timesaver this really is. Didn't even mention tests.. Which can you auto
generate?
Especially if your project's outputed code isn't template driven where each
user of it can change the boiler plate code with minimal or no fuss, so it can
be tailored to each users needs. Like I'm able to add in my most used
imports, which aren't all going to be yours or anyone elses or the same in
each project.
I think the minimal approach of django-admin is a much better way to do these
things. With either way you still have to give the fields, options and the
names, then fill in the functions you need/want. Each function that can be
autogenerated is like two lines of code.
I don't know if your generated code can handle a lot of choices I make, like
making fields not editable in the admin, setting defaults, etc... and even if
you do offer these choices, the time to use your project and code it up
probably isn't much different.
The big thing for me in terms of tools like this, is the ability to save time,
which I don't think there is a difference between what django-admin has and
your project. Because either way I need to still fill in the fields, the type
of field it is, etc.. and typeing IntegerField() isn't faster than selecting
from a drop down box.
Tho the importing of existing models maybe interesting for refactoring, Tho I
just cp oldversion newversion and make the changes.
I still have a large feeling I'm going to editting what your project outputs
(blame this on things like UML). When I would just rather write it once and
forget it.
I also love building development tools, I'm just finishing up something like
this for Go. Where it'll generate a project directory tree of your Go files
(either a package or command, with Makefiels, readme, etc.. all template
driven so you can edit the boilerplate code to be what you want) it'll be
released in a few more days when I finish cleaning up the default templates
and a few optimizations. If you want to see what I mean, I don't mind sending
it today. Just know there are a lot of mistakes in the templates and still
looking at a few tweaks and playing with usability.
But in the end, I think the time saved with yours is going to be minimal I
believe unless your can guess what model fields I need and what options they
are it's not saving that much time (maybe 30 minutes?). Otherwise, I think
that altering django-admin startporject to be template driven is a better idea
than this. Sorry for being negative, but without negativity how can we be
challenged and grow?
Mike
--
After the Children of Israel had wandered for thirty-nine years
in the wilderness, Ferdinand Feghoot arrived to make sure that they would
finally find and enter the Promised Land. With him, he brought his
favorite robot, faithful old Yewtoo Artoo, to carry his gear and do
assorted camp chores.
The Israelites soon got over their initial fear of the robot and,
as the months passed, became very fond of him. Patriarchs took to
discussing abtruse theological problems with him, and each evening the
children all gathered to hear the many stories with which he was programmed.
Therefore it came as a great shock to them when, just as their journey was
ending, he abruptly wore out. Even Feghoot couldn't console them.
"It may be true, Ferdinand Feghoot," said Moses, "that our friend
Yewtoo Artoo was soulless, but we cannot believe it. He must be properly
interred. We cannot embalm him as do the Egyptians. Nor have we wood for
a coffin. But I do have a most splendid skin from one of Pharoah's own
cattle. We shall bury him in it."
Feghoot agreed. "Yes, let this be his last rusting place."
"Rusting?" Moses cried. "Not in this dreadful dry desert!"
"Ah!" sighed Ferdinand Feghoot, shedding a tear, "I fear you do not
realize the full significance of Pharoah's oxhide!"
-- Grendel Briarton "Through Time & Space With Ferdinand
Feghoot!"
It does provide you a skeleton that you're supposed to adapt. I wanted
it to be as simple as possible.
> this stuff with the code i.e. ModelFoms. I don't know how much of a real
> timesaver this really is. Didn't even mention tests.. Which can you auto
> generate?
Doesn't make so much sense to me to generate test
>
> Especially if your project's outputed code isn't template driven where each
> user of it can change the boiler plate code with minimal or no fuss, so it can
> be tailored to each users needs. Like I'm able to add in my most used
> imports, which aren't all going to be yours or anyone elses or the same in
> each project.
I though about it (adding profile, css framework, JS framework...),
but doesn't have yet a good idea on how to integrate it right now...
and it doesn't feet my first goal which is
to quickly create a working project structure that can be easily extended.
>
> I think the minimal approach of django-admin is a much better way to do these
> things. With either way you still have to give the fields, options and the
> names, then fill in the functions you need/want. Each function that can be
> autogenerated is like two lines of code.
> I don't know if your generated code can handle a lot of choices I make, like
> making fields not editable in the admin, setting defaults, etc... and even if
> you do offer these choices, the time to use your project and code it up
> probably isn't much different.
>
> The big thing for me in terms of tools like this, is the ability to save time,
> which I don't think there is a difference between what django-admin has and
> your project. Because either way I need to still fill in the fields, the type
> of field it is, etc.. and typeing IntegerField() isn't faster than selecting
> from a drop down box.
I cannot really argue with you on that. If you can please try it first.
>
> Tho the importing of existing models maybe interesting for refactoring, Tho I
> just cp oldversion newversion and make the changes.
>
> I still have a large feeling I'm going to editting what your project outputs
> (blame this on things like UML). When I would just rather write it once and
> forget it.
>
> I also love building development tools, I'm just finishing up something like
> this for Go. Where it'll generate a project directory tree of your Go files
> (either a package or command, with Makefiels, readme, etc.. all template
> driven so you can edit the boilerplate code to be what you want) it'll be
> released in a few more days when I finish cleaning up the default templates
> and a few optimizations. If you want to see what I mean, I don't mind sending
> it today. Just know there are a lot of mistakes in the templates and still
> looking at a few tweaks and playing with usability.
I would like to see it. that would probably give me some ideas
> But in the end, I think the time saved with yours is going to be minimal I
> believe unless your can guess what model fields I need and what options they
> are it's not saving that much time (maybe 30 minutes?). Otherwise, I think
> that altering django-admin startporject to be template driven is a better idea
> than this. Sorry for being negative, but without negativity how can we be
> challenged and grow?
You can be negative but it's hard to take some of your arguments when
obviously you didn't try it :p
Otherwise I appreciate your argumentation on some points. It's true
that optimizing the existent is often the best practice. This more
another approach in the spirit of perfectionists with deadlines ( it's
far from the perfection ).
Thank you Mike
> > The big thing for me in terms of tools like this, is the ability to save
> > time, which I don't think there is a difference between what django-admin
> > has and your project. Because either way I need to still fill in the
> > fields, the type of field it is, etc.. and typeing IntegerField() isn't
> > faster than selecting from a drop down box.
>
> I cannot really argue with you on that. If you can please try it first.
>
I just don't see how it can work, without me entering the data/info I need,
which I don't see as better/faster than me just coding it up from the files
provided by django-admin. I'll try it when I start a new project, but sorry
that's not this week or month. Which is why I asked originally how it's
different from django-admin.
> > I also love building development tools, I'm just finishing up something
> > like this for Go. Where it'll generate a project directory tree of your
> > Go files (either a package or command, with Makefiels, readme, etc.. all
> > template driven so you can edit the boilerplate code to be what you want)
> > it'll be released in a few more days when I finish cleaning up the
> > default templates and a few optimizations. If you want to see what I
> > mean, I don't mind sending it today. Just know there are a lot of
> > mistakes in the templates and still looking at a few tweaks and playing
> > with usability.
>
> I would like to see it. that would probably give me some ideas
>
It's attached.
Mike
--
Given a choice between grief and nothing, I'd choose grief.
-- William Faulkner
This could grow into a really great project, where people
don't even have to learn programming to generate a usable
django web database app. They just design their app with
the user friendly web interface, and it runs. It could even
be integrated with hosting, and people might never see
the code, it would just run. How many people who have web
pages nowadays know HTML?
Generate on!
How many times did I want to do something but could not find a working
example to pick apart? I would think it would make a great way to
show proper layout and conventions for newbies (like me). I have been
programming in python for years but am having some trouble wrapping my
head around the "django" paradigm.
Thanks,
Richard
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>
I really appreciate. That could be new direction that I didn't really
think of. I will finish the permission, form and view integration and
keep in mind to stay minimalistic.
For now, if you have django source installed you just need to
- download the targz file
- run ./manage syncdb
- run ./manage runserver
and it should work.
2010/2/9 Frank W. Samuelson <fr...@merrill-samuelson.com>:
I put most of my coding convention inside and try to respect the pep8.
A lot of work still need to be done. But I expect to reach my goal by
the next 15 days
Brice
2010/2/9 Richard Shebora <she...@gmail.com>:
Isn't this what existing django-apps are for?
> They just design their app with
> the user friendly web interface, and it runs.
> It could even
> be integrated with hosting, and people might never see
> the code, it would just run.
This is possible, but I would rather have an installer that installs apps that
are already made by good programmers who know what they are doing.
> How many people who have web
> pages nowadays know HTML?
And I don't agree/like this, if you don't want to learn html, higher a
professional.
would you drive a car built by a guy who has never driven, much less fixed a
car because he was able to put one together from a kit?
Because you can, doesn't mean that you should...
It's this type of mentality that leads to security holes and bad web apps that
hurt server performance and many different things...
A bad django app made this way can hurt django's reputation.
Mike
--
Machine Always Crashes, If Not, The Operating System Hangs (MACINTOSH)
-- Topic on #Linux
I have to agree with this, I think it fits this niche perfectly.
Mike
--
A public debt is a kind of anchor in the storm; but if the anchor be
too heavy for the vessel, she will be sunk by that very weight which
was intended for her preservation.
-- Colton
Would you eat some food not cook by a professional ?
>
> Because you can, doesn't mean that you should...
>
> It's this type of mentality that leads to security holes and bad web apps that
> hurt server performance and many different things...
Not everybody needs to run facebook.
Your approach seams to be "if it's not perfect it should not be used".
Don't you think it's a little to extreme ?
>
> A bad django app made this way can hurt django's reputation.
That's pretty severe.
I would be very wary of a person who hasn't cooked before... The difference is
in experience.
> > Because you can, doesn't mean that you should...
> >
> > It's this type of mentality that leads to security holes and bad web apps
> > that hurt server performance and many different things...
>
> Not everybody needs to run facebook.
> Your approach seams to be "if it's not perfect it should not be used".
> Don't you think it's a little to extreme ?
>
No, I may lose a bit of perspective because I don't think in terms of the
layman, but at the same time I'm not about to get into something unless I know
enough about it first and if that means taking classes at community college...
That's what I do.
I'm more against something like my mom putting together a website because she
won't do the neccessary homework first. I think that without knowledge of what
you're doing, you're doomed to fail. If webservers were either all VPS's with
limits monitored by the host os or dedicated servers for each site, then I
wouldn't say much on this, but virtual hosting is another story, where you
have the potential to hurt others. This is the main problem here is that we
think in terms of how it affects ourselves only. what about others?
> > A bad django app made this way can hurt django's reputation.
>
> That's pretty severe.
>
Maybe, but public opinion is easily swayed and django is still fighting
against other more popular systems.
Mike
--
Big M, Little M, many mumbling mice
Are making midnight music in the moonlight,
Mighty nice!
it's just that I don't like those ridiculous images that shows the
world as binary. You can effectively be sure that nobody want's to
flight in an home made plane and nobody want his butcher to be his
surgeon. But in the past I painted the wall by myself, and made myself
some pretty good pasta :p
>
>> > Because you can, doesn't mean that you should...
>> >
>> > It's this type of mentality that leads to security holes and bad web apps
>> > that hurt server performance and many different things...
>>
>> Not everybody needs to run facebook.
>> Your approach seams to be "if it's not perfect it should not be used".
>> Don't you think it's a little to extreme ?
>>
>
> No, I may lose a bit of perspective because I don't think in terms of the
> layman, but at the same time I'm not about to get into something unless I know
> enough about it first and if that means taking classes at community college...
> That's what I do.
>
> I'm more against something like my mom putting together a website because she
> won't do the neccessary homework first. I think that without knowledge of what
> you're doing, you're doomed to fail. If webservers were either all VPS's with
> limits monitored by the host os or dedicated servers for each site, then I
> wouldn't say much on this, but virtual hosting is another story, where you
> have the potential to hurt others. This is the main problem here is that we
> think in terms of how it affects ourselves only. what about others?
Actually I had that in mind. For example, the code generated for list
is using pagination to avoid mass data reading from the db.
The purpose of this tool is to go further than createproject and in
another way like being able to fork an existing project or quickly
include existing recognized pluggable.
>
>> > A bad django app made this way can hurt django's reputation.
>>
>> That's pretty severe.
>>
>
> Maybe, but public opinion is easily swayed and django is still fighting
> against other more popular systems.
>
> Mike
>
--
blog: http://www.debrice.com
project: http://www.kaaloo.com http://www.djangogenerator.com
linkedin: http://www.linkedin.com/in/bricepleroy
But in both cases this was only affecting you... I don't care if you shoot
heroin, as long as that habit doesn't negatively affect others around you.
This is the key to my argument.
> >> > Because you can, doesn't mean that you should...
> >> >
> >> > It's this type of mentality that leads to security holes and bad web
> >> > apps that hurt server performance and many different things...
> >>
> >> Not everybody needs to run facebook.
> >> Your approach seams to be "if it's not perfect it should not be used".
> >> Don't you think it's a little to extreme ?
> >
> > No, I may lose a bit of perspective because I don't think in terms of the
> > layman, but at the same time I'm not about to get into something unless I
> > know enough about it first and if that means taking classes at community
> > college... That's what I do.
> >
> > I'm more against something like my mom putting together a website because
> > she won't do the neccessary homework first. I think that without
> > knowledge of what you're doing, you're doomed to fail. If webservers were
> > either all VPS's with limits monitored by the host os or dedicated
> > servers for each site, then I wouldn't say much on this, but virtual
> > hosting is another story, where you have the potential to hurt others.
> > This is the main problem here is that we think in terms of how it
> > affects ourselves only. what about others?
>
> Actually I had that in mind. For example, the code generated for list
> is using pagination to avoid mass data reading from the db.
> The purpose of this tool is to go further than createproject and in
> another way like being able to fork an existing project or quickly
> include existing recognized pluggable.
>
I can see this being helpful, but I can't see it as a general hosting service
installer system... That is just a very bad idea. In the end, I see this as
three things, an Educational tool -- first (thanks for that pespective
Richard), secondly a build tool for experienced programmers and lastly, a
controlled SaaS.
For me, I saw this first as a replacement for startproject which in my mind
isn't perfect, but the best we have. Because I don't see how something like
this can save that much time, nor am I a believer in there is only one way to
code a good app, I came across negative. I don't usually have the same info or
code in each project, outside of what startproject gives and refactoring, well
I went over that. (Also goproject shaped my perspective as it's what I've been
messing iwth mainly over the past few weeks in an effort ot learn/undertand
Go).
Unless you're going to go with something like wordpress.com and have it launch
sites for others and you still maintain control over most of the code and that
edits by users are limited... Really where they only need to deal with the
frontend that's great, but even then... Experience matters (XSS and bad js can
clog up browsers). I'm really wary about unknowledgeable users editting
things that can mess up the site and the service. Making it easier for the
laymen is like tossing free money into a crowd, sure it's a nice thing, but it
has the potential for catastrophe. If that potential is removed or severly
limited, I can jump on whole heartedly as a supporter. I think your plan is
better as a SaaS, than to target the laymen to use django.
The above is also something I think is fundamentally different from say
dreamhost or webfaction adding this in to their software installers, which is
where the potential for catastrophe starts to grow exponentially as users make
edits that can blow things up.
> >> > A bad django app made this way can hurt django's reputation.
> >>
> >> That's pretty severe.
> >
> > Maybe, but public opinion is easily swayed and django is still fighting
> > against other more popular systems.
> >
Just to add to this, PHP is the example, it's rep is really bad, mainly
because of bad programmers building bad applications. Now wp, joomla, drupal
(before phpnuke and there was one more, forgot it), help this, but they all
have issues that are driving users away.
Mike
--
PUNK ROCK!! DISCO DUCK!! BIRTH CONTROL!!
I already have a better understanding of what is going on and expect
this to help me get up to speed with Django very fast. I learn best
by example and can now try out various things and get a working set-up
each time. After a while I always just rely on memory and write code
directly.
Not only is it something I can learn from but it does look like a more
"comprehensive" startproject / startapp utility. I can see using this
to create starting points for various types of projects or
applications. If "Generator" gets even more advanced it could turn
into a way of stockpiling my own re-usable apps that I could quickly
paste together in a web interface, download the project and let the
customization begin!
Imagine if you could use a "Generator" like concept to set-up Pinax,
Satchmo or both into a project, taking only the pieces of each you
need. The whole point of those two projects is to allow me to focus
on what is unique about my project and rely on them for the
boilerplate code. Why not have an application that allows me to pick
and choose and create the project all at the same time?
Thank you Brice for the great work on this!
Appreciatively,
Richard
First time I looked at this project, I thought "it's lame". But so many great
ideas are bashed at first. That's what makes them great ideas. They wouldn't
be so great if everyone could understand the first time. So this is a good
idea, IMHO.
I have just registered and played with the interface for about a minute. I
didn't even bothered to see the code it generates before writing this e-mail.
I think you should just continue working on it. I hope I will have some time
to play with the code myself. I suggest everybody reading this to just
register and give this project 5 minutes of their time:
http://alpha.djangogenerator.com
Small suggestions:
* Please remove `auto_now` and `auto_now_add` since they're deprecated.
* `choices` takes a string and it doesn't cast it to an iterable when
generating code. `choices` should be a list of two-tuples in the form of
(value, verbose_name).
* To promote good practises generated code should follow Django coding
guidelines (PEP8 and other stuff)
As I said, it's really a cool project. Thanks for sharing.
--
Saygılarımla,
Atamert Ölçgen
-+-
--+
+++
> * Please remove `auto_now` and `auto_now_add` since they're deprecated.
No, they really aren't. If they were deprecated, there would be
deprecation warnings in the code and documentation.
Yours,
Russ Magee %-)
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
I woke up this morning and saw all those email and I would like to
thank you all for all those advices and support you wrote. That
motivates me even more to work on it.
The project being in alpha stage, please keep in mind that your
project integrity and its storage is not guaranteed and the data model
will probably evolve a lot during the next month (I don't want to use
south until beta)
I'll will now focus and reaching the beta stage:
- Form generator
- View generator
- Permissions
- more unittest
- PEP8 code compliant generation
- Some pluggable (profile, registration, djangodblog, django-mailer...)
- A user guide
- settings.py customization
(wow... way more things than I though...)
If you have any idea concerning unit-test generation, I would be
please to hear about it. I'm actually thinking about adding some test
for each forms using client so it can become easy to customize. The
direction the project is taking is a learning tool and a project fast
start tool.
Again, any idea on the tool is welcome.
If you're good in layout, feel free to recommend a better one too. The
project is advanced enough to give you an idea of what's need to be
visible and not too much so it can be quickly modified.
Atamert Ölçgen: I'll try to fix the issue with the choice field as
nicely as possible (casting or js trick) so it doesn't break the
usability.
Thank you all again !
Brice
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Thank you for your support.
Brice
2010/2/10 Wolf Halton <wolf....@gmail.com>:
Thank you. I'm focusing right now on unittest. Once forms unittest is
done I will start adding new feature
> Just a few notes:
> - the generator page takes quite a bit of vertcal real estate: a more
> compact display may be better?
I'm thinking of having the field condensed on 1 line and being able to
expand detail view using js. As I explained before, if you have any
advice on usability/design I would be very happy to hear about them !
Once I'm done with permissions and forms, I will probably work a
little more on the website itself adding a page to provide an overview
of the project without having to register, a feedback tool, help
section and a tutorial.
> - if the goal is to provide a tool for non-developers, you may be
> expose a bit too much of django internals: for instance such a user
> may not care for the field types, know what a model is, etc. Yet if it
> is for hand-holding django newbies you introduce many concepts that a
> newbie may not know about yet. So my 2 cents would be to pick a target
> user and focus on one or the other. As I see it today, only a django
> user would be able to make sense of it.
I agree on that but I'm not really fixed on the direction and audience
for the project. I try to keep it as simple as possible, so it's not
to hard to maintain and provide good and clean output. I hate those
project that never works because you have to learn about it. I would
like this project to generate easy to read code, with no dependencies
and using django and python recommandation.
My first thought was a solution to provide quickly basic models, forms
and views so it give me more time to focus on fun and complex
behavior.
> - the license you picked seems to me a bit odd for software
> http://github.com/debrice/djangogenerator/blob/master/LICENSE , you
> may want to consider something more common: the same as django is
> usually the simplest and best.
I will investigate on this.
> - some pointers on some similar tools may give you some more ideas,
> google web site generator
> there are many similar tools for RAILS, PHP, JSP, ASP, etc
I will google that ;)
> Bon courage!
> Philippe
Merci Philippe !