How about converting python config files to text config files

43 views
Skip to first unread message

limodou

unread,
Feb 9, 2006, 10:27:10 PM2/9/06
to django-d...@googlegroups.com
I'v summited a ticket http://code.djangoproject.com/ticket/1337 for this.

What do you think about?

--
I like python!
My Blog: http://www.donews.net/limodou
NewEdit Maillist: http://groups.google.com/group/NewEdit

Russell Keith-Magee

unread,
Feb 9, 2006, 11:22:21 PM2/9/06
to django-d...@googlegroups.com
On 2/10/06, limodou <lim...@gmail.com> wrote:

I'v summited a ticket http://code.djangoproject.com/ticket/1337 for this.

What do you think about?

-1  from me.

The existing syntax is text-based, clear, concise, expressive, and pythonic (since it actually _is_ python).

If we introduce a new syntax for config files, we would need to write a parser for that syntax, validate errors in that syntax, document the new syntax. These features we get for free by using Python as a config syntax.

The existing syntax is also Turing complete, so (if needed) you can use python code to set the value of settings. This is _way_ outside the scope of a 'simple text' config syntax, and would result in a whole new programming language if attempted.

I fail to see what problem would be solved or made easier by introducing a new syntax.

Russ Magee %-)

Sean Perry

unread,
Feb 10, 2006, 12:29:51 AM2/10/06
to django-d...@googlegroups.com
Russell Keith-Magee wrote:
> I fail to see what problem would be solved or made easier by introducing a
> new syntax.
>

sometimes people like to use a language other than python but share some
data.

limodou

unread,
Feb 10, 2006, 12:39:57 AM2/10/06
to django-d...@googlegroups.com
On 2/10/06, Russell Keith-Magee <freakb...@gmail.com> wrote:
>
> On 2/10/06, limodou <lim...@gmail.com> wrote:
> >
> > I'v summited a ticket
> http://code.djangoproject.com/ticket/1337 for this.
> >
> > What do you think about?
>
> -1 from me.
>
> The existing syntax is text-based, clear, concise, expressive, and pythonic
> (since it actually _is_ python).

I agree, but not very suit for automaticl tools. Do you like manually
modifying settings.py and urls.py every time to install a app? Why
don't we make these things easier? What I suggest is aimed to
automatic tools. Because ini format is easy for changing.


>
> If we introduce a new syntax for config files, we would need to write a
> parser for that syntax, validate errors in that syntax, document the new
> syntax. These features we get for free by using Python as a config syntax.
>

There are some ini parser existed can do similar work, may be we can
choose one for this work. Just like ConfigObj also supply a validator
to do the validation. And if the settings process just like this:

if exists(settings.py):
import settings.py
if exists(settings.ini):
process(settings.ini)

One can choose what he want. So the text configuration can be only
used in automatic tools. Of course it may confuse the user.

> The existing syntax is also Turing complete, so (if needed) you can use
> python code to set the value of settings. This is _way_ outside the scope of
> a 'simple text' config syntax, and would result in a whole new programming
> language if attempted.
>

This is why automatic work cannot be implemented so easily.

> I fail to see what problem would be solved or made easier by introducing a
> new syntax.
>

--

limodou

unread,
Feb 10, 2006, 12:49:10 AM2/10/06
to django-d...@googlegroups.com

I also think django indeed need some automatic tools, just like paste.
But I don't know more about it. So how to quickly deploy a django
project in server and how to quickly and easily deploy many apps, and
how to update them. If we have a tool can do these things, I think
django will be more powerful and easier.

But automatically installing an app is not a simple thing, the big
problem is : how to modify the settings.py and urls.py. If there is a
simple way to do that, then not using text files for configuration is
all right. Buf for now, I don't know if there is a simple way to
modify the settings.py and urls.py. So I think, the text configuration
files can be the easiest way for automation.

Jonathan Daugherty

unread,
Feb 10, 2006, 1:07:19 AM2/10/06
to django-d...@googlegroups.com
# But automatically installing an app is not a simple thing, the big
# problem is : how to modify the settings.py and urls.py.

I think the answer is writing code in settings.py and urls.py that
looks elsewhere for specific config information, rather than making
settings.py and urls.py text files. A great deal of Django's
considerable configuration power comes from the fact that these files
are in Python.

I'm -2 on converting these files to anything else, but a HOWTO or wiki
page on "ways to make your settings.py and urls.py files aware of
things that might be site-specific" -- or even a quasi-standard way to
do this sort of thing -- would definitely be good. I know that in my
projects, I have a PROJECT_HOME environment variable that I define,
for example, which is the directory inside which templates, code, etc
can be found. It makes deploying production and development copies of
a project very easy. You can employ similar techniques.

But at any rate, you can always just write a python script that
imports the settings and programmatically traverses them if you need
to inspect them.

--
Jonathan Daugherty
http://www.parsed.org

Russell Keith-Magee

unread,
Feb 10, 2006, 1:07:52 AM2/10/06
to django-d...@googlegroups.com
On 2/10/06, limodou <lim...@gmail.com> wrote:

On 2/10/06, Russell Keith-Magee <freakb...@gmail.com> wrote:
>
> The existing syntax is text-based, clear, concise, expressive, and pythonic
> (since it actually _is_ python).

I agree, but not very suit for automaticl tools. Do you like manually
modifying settings.py and urls.py every time to install a app? Why
don't we make these things easier? What I suggest is aimed to
automatic tools. Because ini format is easy for changing.

Initial application setup is a once-only task. django-admin.py will create a stub settings.py and urls.py for you. This is already automated.

Modifications to urls.py can't be automated, because they require description of a regular expression for URL matches. You could write a 'wizard' to help, but I would suggest that the effort involved in writing the wizard vastly outstrips the need.

The addition of an extra line in the installed application list of settings.py is only a one line change - so again, I would argue effort > need.

However, even if there was a large need, it could be acheived without changing the config syntax; either modify settings.py to load its application list from some other location (or dynamically discover applications), or write a settings.py 'rewriter' - a tool that rewrites the content of settings.py with additions. You can get a simple version using import and pprint; alternatively, you could refactor and reuse the same logic that django-admin uses to output the settings in the first place.

This is why automatic work cannot be implemented so easily.

Pardon? A Turing complete language makes it _harder_ to do automated work? If anything, it should be _easier_, because there is no separation between code and data.

Russ Magee %-)

limodou

unread,
Feb 10, 2006, 1:18:13 AM2/10/06
to django-d...@googlegroups.com

You may not understand what I want. For example:

I have a app name address, now, I want to install it in django. How to do that?

1. modifying settings.py to add INSTALLED_APPS
2. modifying usrl.py to add urlpatterns
3. run install address command

But for now, you need manually to do that. (Maybe someone is
instresting in my new project djangoinstall, it can do these things
aumatically)

So what I mean not about HOW TO READ settings from settings.py, but
HOW TO MODIFY settings.py and urls.py.

And one thing why I want this is : I want NewEdit can do some work on
development, for example, I have a views.py, and I want to map the
method into urls.py. If I just import urls.py, it's no use for the
editor.

So I think .py configuration file is not user friendly to a IDE.

Tom Tobin

unread,
Feb 10, 2006, 1:24:33 AM2/10/06
to django-d...@googlegroups.com
On 2/9/06, Russell Keith-Magee <freakb...@gmail.com> wrote:
>
> On 2/10/06, limodou <lim...@gmail.com> wrote:
> >
> > I'v summited a ticket
> http://code.djangoproject.com/ticket/1337 for this.
> >
> > What do you think about?
>
> -1 from me.

I second that -1; by the logic in that ticket, we might as well
rewrite the module definitions in a config.ini format since end users
might want to fiddle with the modules in a given deployed app. :-p

Seriously, though, I don't see Python's syntax as an obstacle for
casual config tweaking. I'm guessing the use-case in the ticket is
concerned with those who might someday be making use of Django with
ready-to-run plug-in applications (whether from django.contrib or
third parties), with little concern for playing with models, views,
and the like. A basic settings.py is nothing but variable assignments
with strings and tuples; as for urls.py, plug-in apps will likely
handle all the heavy regex lifting on their own end, leaving the
installing user to drop a simple include line into the file. I'm not
sure if a user who isn't comfortable doing even that much should be
installing Django on their own. ;-)

Jonathan Daugherty

unread,
Feb 10, 2006, 1:44:43 AM2/10/06
to django-d...@googlegroups.com
# I have a app name address, now, I want to install it in django. How
# to do that?
#
# 1. modifying settings.py to add INSTALLED_APPS
# 2. modifying usrl.py to add urlpatterns
# 3. run install address command

I see what you mean, but this is a one-time task, done at development
time. I don't think it's bad to do this manually, particularly
because it doesn't need to be done often. What's the impetus for
wanting an automated way to perform this kind of task?

limodou

unread,
Feb 10, 2006, 1:35:14 AM2/10/06
to django-d...@googlegroups.com
On 2/10/06, Russell Keith-Magee <freakb...@gmail.com> wrote:
>
> On 2/10/06, limodou <lim...@gmail.com> wrote:
> >
> > On 2/10/06, Russell Keith-Magee <freakb...@gmail.com> wrote:
> > >
> > > The existing syntax is text-based, clear, concise, expressive, and
> pythonic
> > > (since it actually _is_ python).
> >
> > I agree, but not very suit for automaticl tools. Do you like manually
> > modifying settings.py and urls.py every time to install a app? Why
> > don't we make these things easier? What I suggest is aimed to
> > automatic tools. Because ini format is easy for changing.
>
> Initial application setup is a once-only task. django-admin.py will create a
> stub settings.py and urls.py for you. This is already automated.
>
> Modifications to urls.py can't be automated, because they require
> description of a regular expression for URL matches. You could write a
> 'wizard' to help, but I would suggest that the effort involved in writing
> the wizard vastly outstrips the need.
>
> The addition of an extra line in the installed application list of
> settings.py is only a one line change - so again, I would argue effort >
> need.

Maybe it's simple, but what about install an app? You should modify:

settings.py
urls.py
copy media files to special directory

I want these things can be done easily. For example, I download a
third app, and want to run with it. If I could only supply some
parameters about my environment let things easily be done, that will
be so happy. But if there is a tool for this thing, it may need to
modify the settings.py and urls.py automatically according to the
parameters supplied from you.

>
> However, even if there was a large need, it could be acheived without
> changing the config syntax; either modify settings.py to load its
> application list from some other location (or dynamically discover
> applications), or write a settings.py 'rewriter' - a tool that rewrites the
> content of settings.py with additions. You can get a simple version using
> import and pprint; alternatively, you could refactor and reuse the same
> logic that django-admin uses to output the settings in the first place.

If these can be supplied, it may be better than what I proposed. What
I proposed may should be changed to "Need automatic process support,
especially install apps".


>
> > This is why automatic work cannot be implemented so easily.
>
> Pardon? A Turing complete language makes it _harder_ to do automated work?
> If anything, it should be _easier_, because there is no separation between
> code and data.
>

Maybe I expressed my ideas not so clearly, I'm sorry. Just like above
what I said, what I really want is a mechanism aim for automatic work
and automatic tools. So changing configuration files more simpler is
more better.

What I released project djangoinstall really can do somethings like
this, but I think if it's more easier that's would be better. And I
also want some IDE can also support django to.

limodou

unread,
Feb 10, 2006, 1:53:21 AM2/10/06
to django-d...@googlegroups.com
On 2/10/06, Jonathan Daugherty <cyg...@cprogrammer.org> wrote:
>

Maybe you consider that it's nothing, so I think you also don't want a
tool to do that for you automatically. But I want, and I think maybe
someone else want also.

And you can also assume that, I have a developing environment and an
online enrironment. In developing enrironment, I may need install many
apps(for the future) which are not written by me. So for each app, I
should carefully read the installation document supplied by the app,
and I need repeat the steps above and even need more steps, e.g.
installing third party module, install media files, install js
libraries, etc. And also everyone need to install this app also need
to these things. And if I'v finished my project, I'll need install
them to online server, but maybe I cann't just copy all files to the
online server, so maybe I need install the apps to online server. So I
need repeat the steps again.

Do you want these? Why not make a tool for that? That's why I need
more simple automatic support supplied by django. And maybe someone or
something else also need these mechanism, just like an Editor?

James Bennett

unread,
Feb 10, 2006, 2:26:22 AM2/10/06
to django-d...@googlegroups.com
On 2/10/06, limodou <lim...@gmail.com> wrote:
> Maybe you consider that it's nothing, so I think you also don't want a
> tool to do that for you automatically. But I want, and I think maybe
> someone else want also.

What, exactly, is it about Python files which make it, in your view,
unreasonably difficult to automate the process? If anything, having
the settings in Python should mean that it's *easier* to automate,
because you can load the settings file as Python and manipulate items
in it natively.


> libraries, etc. And also everyone need to install this app also need
> to these things. And if I'v finished my project, I'll need install
> them to online server, but maybe I cann't just copy all files to the
> online server, so maybe I need install the apps to online server.

What, right at this moment, is stopping you from being able to write
tools which do these things? Why would the format of the files matter
to a script whose purpose is to upload a set of files and run a
command on the server when that's done?

> Do you want these? Why not make a tool for that? That's why I need
> more simple automatic support supplied by django. And maybe someone or
> something else also need these mechanism, just like an Editor?

Django provides enough automation right now, in my opinion. If you
need or want more automation, I don't see anything that's getting in
the way of your being able to write more automation tools for your own
use, least of all the file format of Django's configuration.

--
"May the forces of evil become confused on the way to your house."
-- George Carlin

Maniac

unread,
Feb 10, 2006, 2:35:48 AM2/10/06
to django-d...@googlegroups.com
limodou wrote:

>I'v summited a ticket http://code.djangoproject.com/ticket/1337 for this.
>
>What do you think about?
>
>

You can store settings in any format right now and use settings.py as a
parser:

from my_parser import my_parse

values=my_parse('my_config.ini')
locals().update(values)

limodou

unread,
Feb 10, 2006, 2:39:30 AM2/10/06
to django-d...@googlegroups.com

please see another thread to see what I really want, what I want not
just READ but WRITE and SAVING.

Max Battcher

unread,
Feb 10, 2006, 4:03:01 AM2/10/06
to django-d...@googlegroups.com
limodou wrote:
>> The addition of an extra line in the installed application list of
>> settings.py is only a one line change - so again, I would argue effort >
>> need.
>
> Maybe it's simple, but what about install an app? You should modify:
>
> settings.py
> urls.py
> copy media files to special directory
>
> I want these things can be done easily. For example, I download a
> third app, and want to run with it. If I could only supply some
> parameters about my environment let things easily be done, that will
> be so happy. But if there is a tool for this thing, it may need to
> modify the settings.py and urls.py automatically according to the
> parameters supplied from you.

If I were to build such a thing, and I'm like most everyone else in that
I don't see a use for it, I would probably just simply start modifying
them in memory and then Pickling_ the Settings module and URL patterns.

.. _Pickling: http://docs.python.org/lib/module-pickle.html

--
--Max Battcher--
http://www.worldmaker.net/

limodou

unread,
Feb 10, 2006, 4:23:30 AM2/10/06
to django-d...@googlegroups.com
Using pickle is more harder to modify by hand. Ok, you don't know how
an automatic tool is useful, so I'll ask you: is django-admin.py
useful? is manage.py useful? These are also automatical tools, but
they can do only separate task, but not many serials tasks. I also
want you assume once you need to install many apps to an existed
django site, how to do that? Maybe these apps have different
directories or different deploy requirements.

So how to do that? If we has a deployment specification which
describes what things need to do for an automatical deployment tool,
and also supply a standard automatic tool and starndard APIs, install
apps may be simple. Then writing a corrrect installation script
belongs to the author of the app. For an end user, what he need to do
is just supply a environment parameters, and run the installation
script, so everything is automatically installed correctly. If that is
true, I may laugh in sleeping.

Amit Upadhyay

unread,
Feb 10, 2006, 5:05:18 AM2/10/06
to django-d...@googlegroups.com

Parsing XML is trivial in python, check out ElementTree, what stops you from doing so?  You are going to parse XML in other languages anyways. In settings.py and urls.py read XMl file, and initialize the required variables.


--
Amit Upadhyay
Blog: http://www.rootshell.be/~upadhyay
+91-9867-359-701

Max Battcher

unread,
Feb 10, 2006, 5:24:27 AM2/10/06
to django-d...@googlegroups.com
limodou wrote:
> Using pickle is more harder to modify by hand.

You can always Python shell, load pickle, change, save pickle. Not that
much more different than load text editor, change, save and quit text
editor.

Or you could load the pickle and then check for changes in the text file.

Or you could do whatever else came to mind that didn't require framework
changes and could make use of the fact that the settings file is just a
Python script that can have arbitrary code or be introspected by some
other outside code. Not to sound rude, I don't really care enough to
come up with a good solution to make you happy. ("Not my problem", "I'm
not going to need it")

> Ok, you don't know how
> an automatic tool is useful, so I'll ask you: is django-admin.py
> useful? is manage.py useful?

My honest opinion (and I apologize for a brief rant) is that these are
both useful and hindrances. My biggest turn off when I saw Ruby on
Rails was the *huge* reliance on automatic scripts. No thanks. I think
that anything that requires such an automatic tool isn't well automated
in the places that count (the abstractions and framework level).

That isn't to say that I don't use manage.py, but that I want to make
sure that I can do everything manage.py can do myself and I know exactly
what it is doing at every point in its operation. When its my source
code at stake, when I need to know every corner of the code in case of
bugs and defects, I'm very wary about any automated tool.

I really like the fact that a similar philosophy has been taken in the
development of Django's manage.py (versus what it might have been) and
that magic-removal has furthered removed some of the reliance on the
tool. (I don't use startapp, for instance.)

> These are also automatical tools, but
> they can do only separate task, but not many serials tasks.

Uh, I can certainly do "serial tasks" with manage.py... I have access
to several available tools such as my Operating System's command scripts
and I know that I can even write a Python script to run through a small
list of manage.py actions.

> I also
> want you assume once you need to install many apps to an existed
> django site, how to do that? Maybe these apps have different
> directories or different deploy requirements.
>
> So how to do that? If we has a deployment specification which
> describes what things need to do for an automatical deployment tool,
> and also supply a standard automatic tool and starndard APIs, install
> apps may be simple. Then writing a corrrect installation script
> belongs to the author of the app. For an end user, what he need to do
> is just supply a environment parameters, and run the installation
> script, so everything is automatically installed correctly. If that is
> true, I may laugh in sleeping.

Maybe we should look at assumptions: I don't see individual
applications as "end-user deployable", I expect individual components to
be pluggable components in an overall Software Design to be installed
and tested by someone knowledgeable. I don't expect my applications to
be seen from the same URL scheme, I expect the install-person to decide
that.

What I see as the "end-user deployable" solution is a connected Project
of applications with a designed URL configuration and settings
configuration, and from what I've seen and done these are deployable
easily enough.

This also more closely mirrors any other website deployment style you
might find.

So again, the existing work is perfect for my needs, and what you are
asking for is a huge change with little/no gain for me.

limodou

unread,
Feb 10, 2006, 6:50:01 AM2/10/06
to django-d...@googlegroups.com
On 2/10/06, Max Battcher <m...@worldmaker.net> wrote:
>
> limodou wrote:
> > Using pickle is more harder to modify by hand.
>
> You can always Python shell, load pickle, change, save pickle. Not that
> much more different than load text editor, change, save and quit text
> editor.

django donot support pickle for now. And what I want is exactly that I
don't want to using a text editor to do that and mainly I don't want
to do it manually. I only want a tool can do all of these things, I
only need write a script, and every will execute as my wish. But if I
want to develop such tool, I want some support from django, first
thing is how to parsing configuration files, and saving the
modification, but this things is not very simple. I mean saving a
modification settings.py and urls.py is not easy, because if you want
the output will be as similar as the old one. I hope doing these
things just like what you do in a text editor, but you did it by hand,
and I did it by program. And also these tools you don't need to use,
if you dislike. But someone like me may be happy to with it. So I need
deal with configuration more easily for such tools. And I also
finished a project called djangoinstall(I'v send an email about this,
but it seems no one here care about it.). But the code is very hackly,
and ugly, I want just simple, and maybe someone like me also want to
write his own tool for these things. So if django can provide a easy
way to chang configuration files easily, may be better. If it cann't
support, the code is just ugly and may not be very correctly.

>
> Or you could load the pickle and then check for changes in the text file.
>
> Or you could do whatever else came to mind that didn't require framework
> changes and could make use of the fact that the settings file is just a
> Python script that can have arbitrary code or be introspected by some
> other outside code. Not to sound rude, I don't really care enough to
> come up with a good solution to make you happy. ("Not my problem", "I'm
> not going to need it")
>
> > Ok, you don't know how
> > an automatic tool is useful, so I'll ask you: is django-admin.py
> > useful? is manage.py useful?
>
> My honest opinion (and I apologize for a brief rant) is that these are
> both useful and hindrances. My biggest turn off when I saw Ruby on
> Rails was the *huge* reliance on automatic scripts. No thanks. I think
> that anything that requires such an automatic tool isn't well automated
> in the places that count (the abstractions and framework level).

I don't see there is so many tools in django, but many commands. Why
you say that "I think that anything that requires such an automatic


tool isn't well automated

in the places that count (the abstractions and framework level)." Did
you ever seen paste project, it's a such thing to deploy a web app to
a server. And maybe some project isn't very suit for automatic
process, but it's not mean we don't need a automatice tool at all.
Automatice tool just works like make(may be we can use make to do
that). It can make operation scriptable, and run it. If you don't want
type commands every time, you can make a makefile. That's just like
what you do in a shell script.


>
> That isn't to say that I don't use manage.py, but that I want to make
> sure that I can do everything manage.py can do myself and I know exactly
> what it is doing at every point in its operation. When its my source
> code at stake, when I need to know every corner of the code in case of
> bugs and defects, I'm very wary about any automated tool.
>
> I really like the fact that a similar philosophy has been taken in the
> development of Django's manage.py (versus what it might have been) and
> that magic-removal has furthered removed some of the reliance on the
> tool. (I don't use startapp, for instance.)

So why you donot mention the DRY principle? If everyone like me need
to do the same thing why not provide a handy tool for that. That's why
was manage.py born. What manage.py do just setup PYTHONPATH and
DJANGO_MODULE_SETTINGS I think, setup these things by hand also very
simple, but why manage.py was borned. Just because DRY. So many people
need to do like these. And why don't ask them: write a shell script,
and run it before your work? Just because we won't people redo the
same things. So I think we can do more beyond manage.py had done. And
of cause, if you don't like it, you don't need to run it. So I also
need parsing, reading, saving configuration files just like modify by
hand, but hacking a python script is not very easy for me, so that why
I post this email.


>
> > These are also automatical tools, but
> > they can do only separate task, but not many serials tasks.
>
> Uh, I can certainly do "serial tasks" with manage.py... I have access
> to several available tools such as my Operating System's command scripts
> and I know that I can even write a Python script to run through a small
> list of manage.py actions.

You are exactly do what I want to do, except that you don't want to
change the configuration files programmatically.


>
> > I also
> > want you assume once you need to install many apps to an existed
> > django site, how to do that? Maybe these apps have different
> > directories or different deploy requirements.
> >
> > So how to do that? If we has a deployment specification which
> > describes what things need to do for an automatical deployment tool,
> > and also supply a standard automatic tool and starndard APIs, install
> > apps may be simple. Then writing a corrrect installation script
> > belongs to the author of the app. For an end user, what he need to do
> > is just supply a environment parameters, and run the installation
> > script, so everything is automatically installed correctly. If that is
> > true, I may laugh in sleeping.
>
> Maybe we should look at assumptions: I don't see individual
> applications as "end-user deployable", I expect individual components to
> be pluggable components in an overall Software Design to be installed
> and tested by someone knowledgeable. I don't expect my applications to
> be seen from the same URL scheme, I expect the install-person to decide
> that.
>

What I mean here "end-user" is just a man who is not the author of a
app which the man what to install it. So if I have a app, you want to
install it, you are the "end-user", and you are also a developer too.
Pluggable system is very nice, but how to let django know them, also
need configration. Automatical support doesn't mean you should install
everything into a same place. It'll be a script, just like what I do
in djangoinstall project. You can write a script, tell the tool how to
modify the settings.py and urls.py, and how to copy files, how to make
directories, and how to anything what you want. The tool is also can
be configured. But how to design a automatic tool is another thing,
it's off this topic.

> What I see as the "end-user deployable" solution is a connected Project
> of applications with a designed URL configuration and settings
> configuration, and from what I've seen and done these are deployable
> easily enough.

Automatic tools can be considered to provide a default ways, so you
can modify the configration laterly. Of cause you can modify the
configration of the tool to suit really need. Also that's off this
topic.


>
> This also more closely mirrors any other website deployment style you
> might find.

If you have time, you can see paste project.


>
> So again, the existing work is perfect for my needs, and what you are
> asking for is a huge change with little/no gain for me.
>

Maybe. I don't know much about the core. I just want my work can be
automatically execute, just like I type:

python setup.py install

everything will be automatically installed correctly.

hugo

unread,
Feb 10, 2006, 9:02:28 AM2/10/06
to Django developers
>I'v summited a ticket http://code.djangoproject.com/ticket/1337 for this.
>What do you think about?

Nope, a big -1 from me. Really - full-python configs is one of the
things I really liked in Django the first time I looked at it. Just try
to drop the idea that configuration is something static - configuration
is living python data, so you can easily make all needed changes via
simple python code.

bye, Georg

Maniac

unread,
Feb 10, 2006, 9:47:06 AM2/10/06
to django-d...@googlegroups.com
limodou wrote:

>please see another thread to see what I really want, what I want not
>just READ but WRITE and SAVING.
>
>

This is exactly what I meant. You can use your own config format, read
it, write it and save it. Settings.py would just import its data for the
rest of the Django.

limodou

unread,
Feb 10, 2006, 9:48:33 AM2/10/06
to django-d...@googlegroups.com
You mean that you'll never want to change them. And I also made a
seconad topic about this, it's seem that you didn't notice it. What I
want just want to make django more easiler for installation,
deployment, or somethings. Have you some good suggestions about how to
simplify the changing of configuration files programmatically always
welcome.

I'm not a obstinate man, and just want to make things better. But it
seems there is no one except me here want to make these repeat and
trivial things more comfortablely and easily. I can also modify these
things by hand, but I hope others don't need repeat these things
again, let him do some useful things. So why I insist that I need
automatic tools, I think if others don't want to repeat the same
things will also need this. And I also explained that parsing python
configuration files is somewhat difficut, and not easy for
maintenance, because I think automatic tools need to deal with
configuration files.

So maybe you all don't like using text configuration files, so do I,
but I cann't think about some other simple ways than using text
configuration. Maybe what has done in djangoinstall project is enough.
If it's true, I'm very glad I'v finished it, even through it's not
very mature.

limodou

unread,
Feb 10, 2006, 10:10:18 AM2/10/06
to django-d...@googlegroups.com
On 2/10/06, Maniac <Man...@softwaremaniacs.org> wrote:
>
If just for myself, I'v finished it in djangoinstall project. And it
can parsing settings.py and urls.py, and also can change the content
of them, then saving the modified content keeping as possible as
similar with original files, even preserving the comments. I'v done
these things. But this way also need to modify the settings.py by
hand, may be you need do it only once. But is someone else also want
to do that, how does he need to do? Just like or somethings others?
Why doesnot django provide a standard why for these things? And if the
one don't like this, he can choose to use or not to use.

Why I propose this thing, because I hope django can permit doing these
things more simple. And let others feel simple and comfortable. Assume
that, you or me or he has developed some apps, and I want to install
it in my box, so if the author also provide a automatic installation
script for that, what I need to do is just pass some environment
parameters and run:

python install.py parameters or parameters.ini

Everything will be done correctly and easily. Of cause, you may won't
like to using intall.py, you want to type every command yourself, and
modify the configuration files by hand.

I'v also admit that may be my proposal is not very clearly express my
opinion, and I also start a new topic about it. But maybe simplifying
the processing of configuration is a big problem I think. Or you also
can propose a good solution. I want a easy way but not a hack way.
Maybe this thing it only suit for me, I don't know.

Adrian Holovaty

unread,
Feb 10, 2006, 10:15:07 AM2/10/06
to django-d...@googlegroups.com
On 2/9/06, limodou <lim...@gmail.com> wrote:
> I'v summited a ticket http://code.djangoproject.com/ticket/1337 for this.
>
> What do you think about?

I marked that ticket as a wontfix yesterday. Respectfully, let me just
say that it's not going to happen. As I implied in the ticket, there's
nothing stopping you from writing your own machinery that creates a
settings file by reading plain text, parsing XML, performing OCR on
scanned paper documents, or analyzing audio clips of you reciting the
settings.

That's the nice thing about having the settings in Python: You can do
whatever you need to do.

Let's move onto other ideas and decisions!

Adrian

--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org

limodou

unread,
Feb 10, 2006, 10:29:55 AM2/10/06
to django-d...@googlegroups.com
On 2/10/06, Adrian Holovaty <holo...@gmail.com> wrote:
>
> On 2/9/06, limodou <lim...@gmail.com> wrote:
> > I'v summited a ticket http://code.djangoproject.com/ticket/1337 for this.
> >
> > What do you think about?
>
> I marked that ticket as a wontfix yesterday. Respectfully, let me just
> say that it's not going to happen. As I implied in the ticket, there's
> nothing stopping you from writing your own machinery that creates a
> settings file by reading plain text, parsing XML, performing OCR on
> scanned paper documents, or analyzing audio clips of you reciting the
> settings.

But there is not a standard interface to do that. And most of the them
need I change these things manually. Even though I'v finished two
modules for doing that programatically, but I want to know if django
can provide a standard interface for doing these things. If there is
no, I'll using my hacking way continually.

>
> That's the nice thing about having the settings in Python: You can do
> whatever you need to do.

I agree. But it's not so easy for doing it programatically, expecially
for saving it just like the original files style, for example, saving
comments in settings.py.

>
> Let's move onto other ideas and decisions!
>
> Adrian
>

As you say that I won't insist more. Thanks all of your patience.

hugo

unread,
Feb 10, 2006, 2:56:45 PM2/10/06
to Django developers
>You mean that you'll never want to change them. And I also made a
>seconad topic about this, it's seem that you didn't notice it. What I
>want just want to make django more easiler for installation,
>deployment, or somethings. Have you some good suggestions about how to
>simplify the changing of configuration files programmatically always
>welcome.

Django _is_ easy to install and deploy. And it won't get easier by your
proposal - actually it would make it harder and more complicated for
people who prefer to compute setting values (which is allmost allways
the case with my project structure, for example).

But if you want to have an environment where you don't set settings
directly in python code but from some external config file, just write
functions to do that (manage that settings file) and use those
functions in your settings.py to populate it's namespace. There is no
one preventing to go that way.

You seem to be fixed on the idea that your tools must manage a file
named "settings.py" - they don't need to, they can manage a file
"settings.txt" and that can be used in your settings.py to pull in
settings (for example using globals()). That way you would install a
Django app and a standard settings.py that would just pull in stuff
that's managed outside, if you want to do it that way. settings.py
could look something along this in your configuration:

import configthingy

for k,v in configthingy.parse('settings.txt'):
globals()[k] = v

That way your settings.py will be populated from some outside source
and that outside source could be managed however you want to.

Your proposal on the other hand would _take_away_ some freedom from
Django programmers and so you hit the wall of -1 quite hard. The
comments to your proposal should show you that you won't get _that_
idea through. If you do it the other way around, your tools just become
another way to do project configuration and people might or might not
adopt it - but without any need of changes to Django, you can do it
alongside django as your own project.

bye, Georg

Bill de hÓra

unread,
Feb 12, 2006, 7:15:02 PM2/12/06
to django-d...@googlegroups.com
limodou wrote:

> You may not understand what I want. For example:
>

> [...]


>
> So I think .py configuration file is not user friendly to a IDE.

I read this, and don't understand how not using Python solves your problem.

-1 from me.

cheers
Bill

limodou

unread,
Feb 12, 2006, 8:12:11 PM2/12/06
to django-d...@googlegroups.com

I don't want to touch this subject more. If you don't understand I'll
explain it again:

I want to using a tool to update the settings.py and urls.py
programmatically, not only reading, but also writing. And even though
I'v finished a project named djangoinstall, it can parsing, updating,
and saving settings.py and urls.py, and it also can remain many
comments in settings.py and urls.py, so someone maybe cann't
distinguish the configuration files was changed be a tool. But my code
parsing and saving settings.py and urls.py is a hacking way, not the
standard way supported by django. So I want django can provide a
starndard way or standard api to let me do this things. Maybe the
topic isnot very clearly express my willings, I'v option other toptic
about I want automatic suppor provided from django.

What you said that hacking settings.py and urls.py is right, but I
don't hope others also need to do this again. If there is a way, it
can permit user customize there own configuration files but doesnot
change the settings.py and urls.py that's will be better. And as I
posted the tiket and this topic, what I could thing out is just
"Convering python file to text file", but maybe is not very well. So
if there is a standard way to do these things and I can used it in
program(so maybe some apis are better), so that's will resolve my
problem.

If you are interesting in djangoinstall, can see what it can do, you
can download it from:

http://wiki.woodpecker.org.cn/moin/LimodouShare?action=AttachFile&do=get&target=djangoinstall.tar.gz

there is a readme.html you can read a simple tutorial about what a
installation tool can do. So the question is that:

It's not that I cannot find a way to hack settings.py and urls.py, but
I want to create some tool can do some automatic works, and django
sould provide some official standard support or APIs for these things.

That it is. I hope someone can understand me.

thanks.

BTW, I'v mentioned that even though that django doesnot provide a
official standard support for customization configuration, I'v also
finished a project. So it isnot that I cann't find out a way to
hacking settings.py and urls.py for my aim, but I hope there is a
official stardard support or apis, so someone like me can create some
tools for automatic works. And I also hope others can enjoy these
tools also if they need such one.

Tom Tobin

unread,
Feb 12, 2006, 9:17:10 PM2/12/06
to django-d...@googlegroups.com
On 2/12/06, limodou <lim...@gmail.com> wrote:
>
> I don't want to touch this subject more. If you don't understand I'll
> explain it again:

I think we understand what you're saying; the problem is that we don't
agree. ;-)

As others have pointed out, it is perfectly acceptable to create your
own configuration files, in your own custom format for your automated
tool, and have the Django config modules read them in. Once you set
up the Django config modules properly to do this, you would never have
to touch them again (barring backwards-incompatible changes or whatnot
-- and maybe not even then, depending on how you set things up).

Where we run into an issue is your request for such a mechanism to be
foisted upon Django itself; as the string of -1 comments thus far
indicates, we specifically *want* and *prefer* Django's config files
to be Python modules. Again, this does not in any way stop you from
implementing your solution; we just aren't going to make it part of
Django proper. :-)

limodou

unread,
Feb 12, 2006, 9:50:32 PM2/12/06
to django-d...@googlegroups.com
On 2/13/06, Tom Tobin <kor...@gmail.com> wrote:
>
> On 2/12/06, limodou <lim...@gmail.com> wrote:
> >
> > I don't want to touch this subject more. If you don't understand I'll
> > explain it again:
>
> I think we understand what you're saying; the problem is that we don't
> agree. ;-)
>
> As others have pointed out, it is perfectly acceptable to create your
> own configuration files, in your own custom format for your automated
> tool, and have the Django config modules read them in. Once you set
> up the Django config modules properly to do this, you would never have
> to touch them again (barring backwards-incompatible changes or whatnot
> -- and maybe not even then, depending on how you set things up).
>
Is that true? I'v assume many scenes just like in development period,
I need install others apps or in deployment period I need reinstall
many new apps also. So the settings.py and urls.py will not always
unchanged. But if django has some configuration customization support,
this aim will be reached.

> Where we run into an issue is your request for such a mechanism to be
> foisted upon Django itself; as the string of -1 comments thus far
> indicates, we specifically *want* and *prefer* Django's config files
> to be Python modules. Again, this does not in any way stop you from
> implementing your solution; we just aren't going to make it part of
> Django proper. :-)
>

So maybe django project should design a pattern that either remaining
the python config files, or simplifying the customization of the
configuration to automatic tools.

And I want to know if such automatic tools is useful to django? Or if
people need these tools to help them?

Thanks.

Reply all
Reply to author
Forward
0 new messages