I am creating a blog engine that will require a user to enter the configuration of the engine in production.ini. I want to create a user interface that allows the user to enter the settings of his/her blog.
I can already get the current settings from the production/development.ini file using
event['theme'] = settings['theme']
event['blogname'] = settings['blogname']
But I also want to be able to get the path of the development/production.ini or the path of the current configuration file that is being used and then save it after editting.
This is not the purpose of the configuration.ini
file. It is explicitly intended to be readonly settings for your app. There is no thread-safety built into the settings dictionary. That being said, global_config['__file__']
exists at app startup with the path to the INI file, so you could overwrite it if you really wanted. But in general the location that file is stored is supposed to be readonly on the filesystem.
Maybe you want to write a script that prompts the user for information and dumps out a production.ini for them to use?
env/bin/setup-blog -o production.ini
Maybe the answers to the questions should be stored in a database or some external storage that supports being mutated at runtime?