草庐IT

Settings_manager

全部标签

python - 使用 Django 的新 i18n_patterns : How to fall back to the default language specified in the settings module?

我正在使用Django1.4的新i18n_patterns:fromdjango.conf.urlsimportpatterns,include,urlfromdjango.conf.urls.i18nimporti18n_patternsfromdjango.contribimportadminadmin.autodiscover()urlpatterns+=i18n_patterns('',url(r'^admin/',include(admin.site.urls)),)它适用于所有活跃的语言:/en/admin/#Ok/es/admin/#Ok但这失败了:/admin/#404

python - "django.db.utils.ProgrammingError: relation "app_user "does not exist"在 manage.py 测试期间

我的设置:Django1.8.3python2.7.10Ubuntu14.04django-two-factor-auth==1.2.0当我运行pythonmanage.pytest时出现以下错误:Traceback(mostrecentcalllast):File"/src/venv/bin/django-admin.py",line5,inmanagement.execute_from_command_line()File"/src/venv/lib/python2.7/site-packages/django/core/management/__init__.py",line33

python - 使用 Flask 从 Jinja 模板中的 settings.py 文件获取变量

假设我有带有一堆常量的settings.py文件(将来可能更多)。我如何在Jinja模板中访问这些变量? 最佳答案 Flask自动将您的应用程序配置包含在standardcontext中.因此,如果您使用app.config.from_envvar或app.config.from_pyfile从您的设置文件中提取值,您已经可以在您的Jinja模板中访问这些值(例如,{{config.someconst}})。 关于python-使用Flask从Jinja模板中的settings.py文件

python - 将 django manage.py 输出(在 Windows 中)重定向到文本文件

我正在尝试将manage.py的输出重定向到文本文件,但只有部分输出被重定向到文本文件。如何将所有输出重定向到文本文件?我的命令提示符:C:\Development\web-py\p1st2\pianos1st-system>pythonmanage.pytest>test_results.txt.....................................................................................................................------------------------------

python - 如何在 Django 1.5+ 中将 settings.LOGIN_URL 设置为 View 函数名称

从Django1.5开始,您可以设置LOGIN_URL到View函数名称,但我一直无法弄清楚如何正确指定它。LOGIN_URL=my_app.views.sign_in...不起作用。我得到错误,ImproperlyConfigured:TheSECRET_KEYsettingmustnotbeempty. 最佳答案 Django在django.contrib.auth.views:redirect_to_login函数中计算这个url为:resolved_url=resolve_url(login_urlorsettings.LO

python - 无法导入设置 'myproject.settings'(它在 sys.path 上吗?): No module named pinax

我正在尝试让pinax在WebFaction上工作,但有很多问题......[SunFeb1920:01:202012][error][client127.0.0.1]mod_wsgi(pid=22796):ExceptionoccurredprocessingWSGIscript'/home/pawesome/webapps/qtsocial/myproject.wsgi'.[SunFeb1920:01:202012][error][client127.0.0.1]Traceback(mostrecentcalllast):[SunFeb1920:01:202012][error][

python - Django:python manage.py migrate 什么都不做

我刚开始学习Django,当我尝试应用我的迁移时,第一个问题出现了。我启动服务器,输入pythonmanage.pymigrate什么也没有发生。没有错误,没有崩溃,只是没有响应。Performingsystemchecks...Systemcheckidentifiednoissues(0silenced).Youhave13unappliedmigration(s).Yourprojectmaynotworkproperlyuntilyouapplythemigrationsforapp(s):admin,auth,contenttypes,sessions.Run'pythonm

python celery - ImportError : No module named _curses - while attempting to run manage. py celeryev

背景Windows7x64Python2.7Django1.4带Redisbundle的celery在尝试运行manage.pyceleryev时,我在终端中收到以下错误importcursesFile'c:\Python2\lib\curses\__init__.py',line15,infrom_cursesimport*ImportError:Nomodulenamed_curses我试过查看其他帖子,但未能解决这个问题。关于导致此错误的原因有什么想法吗?提前致谢。 最佳答案 根据http://docs.python.org/

python - 哪个是最pythonic : installing python modules via a package manager ( macports, apt)或通过pip/easy_install/setuptools

通常我倾向于通过包管理器安装东西,用于unixy的东西。然而,当我编写大量perl程序时,我会使用CPAN、更新版本等等。一般来说,我过去常常通过包管理器安装系统的东西,通过它自己的包管理器(gem/easy_install|pip/cpan)安装语言的东西现在主要使用python,我想知道最佳实践是什么? 最佳答案 系统python版本及其库经常被发行版中的软件使用。只要您使用的软件对与您的发行版相同的python版本和所有库感到满意,那么使用发行包就可以正常工作。然而,您经常需要软件包的开发版本,或更新版本,或旧版本。然后它就不

python - Satchmo 克隆satchmo.py ImportError : cannot import name execute_manager

我让satchmo尝试,但我在第一次尝试时遇到了一个很大的问题,我不明白哪里出了问题。当我将$pythonclonesatchmo.py制作成清晰的django项目时,它会报错:$pythonclonesatchmo.pyCreatingtheSatchmoApplicationCustomizingthefilesPerforminginitialdatasynchingTraceback(mostrecentcalllast):File"manage.py",line18,infromdjango.core.managementimportexecute_managerImport