File name configuration

Are there general naming conventions for config files for a simple python program?

Thank,

Udi

+2


source to share


5 answers


.conf is also a good extension. But since mostly config files are application specific, it doesn't really matter what extension they have as long as they are consistent (I don't use .conf with .cfg in the same application).



+2


source


Agreement? Mine would be, if my program were called "Bob"

, simply "bob.cfg"

.

I must admit that I have not had the slightest concern about this agreement. Maybe I've been here for too long :-)

Of course, if your configuration information is in a specific format (like XML), you might want to consider "bob.xml"

. But, really, I think it ".cfg"

just summarizes the intent just like any convention.



And, just to point out that the bleeding is obvious, don't name your file "bob.cfg"

if your program is actually named "George"

.

Please don't be offended, I don't really accept mickey, just answering an interesting question in the tone of my weird sense of humor. You wouldn't be the first to misunderstand my humor (my wife, for example, despairs of her in most cases).

+4


source


I'm not sure if you mean the base filename if your question also includes where to put the config file. Anyway, in place:

If it is a linux application, you must follow the XDG Base Directory Specification (XDG -> Cross Desktop).

It says that you should put your config files in a folder named after your program in $XDG_CONFIG_HOME/programname/

. XDG_CONFIG_HOME

usually~/.config

+4


source


Django uses it settings.py

I really like it. This is very clear.

+1


source


I don't think there is an agreement for that. You can just use a file with an extension like: .ini, .cfg, .conf, .config, .pref or whatever you like.

0


source







All Articles