Discover Flask, Part 10 - Configuration

preview_player
Показать описание
In Part 10 of this series, we'll update our configuration settings.

Рекомендации по теме
Комментарии
Автор

For windows users having trouble with environment variable do this:

1. Go to system and then Advanced SYstem settings .... then click on Environment Variables
2. Set a new user variable with the variable name:APP_SETTINGS and variable
3. Now press ok and close and also restart the command prompt
4. After starting a new command prompt, start the virtualenv and check again in python shell if all was set correctly

ninadbandodkar
Автор

Just wanted to say that you, Michael, is a very good narrator and lector.

RomanDodin
Автор

Thanks for the thorough explanations on this. I must admit I was a little confused about the app.config settings (as far as using different versions) and you explained it perfectly.

Colstonewall
Автор

Thank you so much for this series, it's incredibly useful.

Pcketfullfsunshine
Автор

I think better than environment variables is a settings file that holds the k:v pairs.  It's more reliable in the case where you don't have complete (or even sudo ) control over your environment.. and can hold all kinds of extra info, like admin emails, pipeline lists, ..whatever you need.

bitwiseParody
Автор

hey i have encountered a the error is when i try to export APP_SETTINGS, I get invalid syntax...
and i am using linux ubuntu ... thanx

susantshrestha
Автор

Michael, Im back at this part from parts 13 & 14, the reason being that everytime I come back to this after a day or so I can't get the app to run locally and when I try to run db_create.py or config.py I get error messages like this: 'raise KeyError(key)
KeyError: 'DATABASE_URL' and it seems that I have to go back to what you did at 11:44 on this video and re-enter this: export and then after doing that it works fine again locally, why do I have to keep doing this though?

DavidJones-lpwz
Автор

anyone getting this error when I set the environment variable?
ImportStringError: import_string() failed for '"config'. Possible reasons are:


- missing __init__.py in a package;
- package or module path not included in sys.path;
- duplicated package or module name taking precedence in sys.path;
- missing module, class, function or variable;


Debugged import:


- '"config' not found.


Original exception:


ModuleNotFoundError: No module named '"config'

Toomey
Автор

and here is where I swtich to a vagrant box (docker is from my nightmares)

enokoner
Автор

When typing "export in the Windows cmd, "export" is not recognized as a command?

LuxisD
Автор

Not entirely sure what's going wrong here. I've even confirmed the table exists with SQLiteBrowser, however I keep getting this OperationError on the debug UI when I go to log in:

OperationalError: (sqlite3.OperationalError) no such table: posts [SQL: u'SELECT posts.id AS posts_id, posts.title AS posts_title, posts.description AS posts_description \nFROM posts']

I've deleted and re-created the database, run the dbcreate.py script and still no luck. Triple checked my syntax.

russellculver
Автор

In windows 10 I am setting up an environment variable like this
Variable name: APP_SETTINGS
Variable value: config.DevelopmentConfig
But its not working what should I do?

waqardetho
Автор

Why did it take you several hours to re-upload 7 videos?

ericmacleod