Ask Your Question

Updating settings

asked 2011-09-11 09:03:35 -0500

AlexP's avatar


If I want to change the value of a field already stored in the database, I get an error for duplicate key. I think it tries to insert the value instead of updating it if it is already in the database.

What can I do ?

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted

answered 2011-09-11 09:26:50 -0500

AlexP's avatar

I update them from MySQL command prompt.

But I was talking about updating the settings from the settings panel.

edit flag offensive delete link more


Next time try the python shell method, it may be just easier. "python shell" then type python commands. In the case with MySQL you just must have typed a wrong command.

Evgeny's avatar Evgeny  ( 2011-09-11 09:29:57 -0500 )edit

I would definitely not recommend updating settings directly through sql, as well as most other things. If you find yourself frequently needing to update something - please let us know, we could maybe write a management command or something like that.

Evgeny's avatar Evgeny  ( 2011-09-11 09:31:37 -0500 )edit

I don't really need a command to manage the settings, but when using the web Interface, I get this error :

IntegrityError at /settings/LOGIN_PROVIDERS/
(1062, "Duplicate entry '1-LOGIN_PROVIDERS-SIGNIN_IDENTI.CA_ENABLED' for key 2")

If I update an existing value.

AlexP's avatar AlexP  ( 2011-09-11 09:40:10 -0500 )edit

That's useful to know. I've tested this on my development environment that runs on sqlite and the production server - on mysql. In both cases works. Have you customized your setup in any way or you are running askbot "out of the box"?

Evgeny's avatar Evgeny  ( 2011-09-11 09:42:20 -0500 )edit

No, it's a standard installation (just updated to version 0.7.22 today). The only changes I made are on the template.

AlexP's avatar AlexP  ( 2011-09-11 09:46:07 -0500 )edit

answered 2018-01-31 21:24:21 -0500

kishan's avatar

What are the settings we can update using settings.update?

Can we enable/disable local login with this? If so, what is the parameter to be used?

edit flag offensive delete link more

answered 2011-09-11 09:15:52 -0500

Evgeny's avatar

It depends on how you are updating the settings - did you write code to do that or typed into django's python shell?

If you want to programmatically update settings, then the way to do it is:

from askbot.conf import settings
settings.update('SETTING_NAME', setting_value)
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2011-09-11 09:03:35 -0500

Seen: 207 times

Last updated: Sep 11 '11