简体   繁体   English

如何使用Git安装Pootle?

[英]How can I install Pootle using Git?

I'm using Ubuntu 14.04 and am trying to install version 2.7 of Pootle , which I've been told I should do with Git rather than pip, which I think is because this version is not stable and so doesn't have a pip package/is not yet set up for use with pip. 我正在使用Ubuntu 14.04,并试图安装2.7版本的Pootle ,有人告诉我应该使用Git而不是pip,这是因为该版本不稳定,因此没有pip软件包/尚未设置为与pip一起使用。 But not being familiar with Python (and am not really much of a programmer at all) I am having trouble with intialising the database with manage.py . 但是不熟悉Python(也不是真正的程序员),我在用manage.py初始化数据库时遇到了麻烦。

So far I have checked out the master branch to /srv/www/pootle/project and upgraded Django in /usr/local/lib/python2.7/dist-packages/django to version 1.7.7 using pip . 到目前为止,我已经检查了master分支到/srv/www/pootle/project并使用pip /usr/local/lib/python2.7/dist-packages/django Django升级到了1.7.7版本。 (See Pootle 2.7 requirements .) (请参阅Pootle 2.7要求 。)

I had previously successfully installed Pootle version 2.5 using pip and the pootle setup to initialise the database, but because Pootle 2.7 has removed the pootle setup command , I've been trying to initialise the database with ./manage.py initdb . 我以前已经使用pip和pootle setup程序成功安装了Pootle 2.5版,以初始化数据库,但是由于Pootle 2.7 删除了pootle setup命令 ,因此我一直在尝试使用./manage.py initdb初始化数据库。 That results in: 结果是:

Traceback (most recent call last):
  File "./manage.py", line 20, in <module>
    cmd_log(*sys.argv)
  File "/srv/www/pootle/project/pootle/core/log.py", line 61, in cmd_log
    fn = settings.LOGGING.get('handlers').get('log_action').get('filename')
  File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 46, in __getattr__
    self._setup(name)
  File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 42, in _setup
    self._wrapped = Settings(settings_module)
  File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 115, in __init__
    raise ImproperlyConfigured("The SECRET_KEY setting must not be empty.")
django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty.

I suppose this is because the Django settings are being used, and not my settings at /srv/www/pootle/pootle.conf which has my secret key and other config. 我想这是因为正在使用Django设置,而不是我在/srv/www/pootle/pootle.conf中的设置,该设置具有我的秘密密钥和其他配置。

I've tried using the --settings=pootle option with manage.py and django-admin.py , with a symlink in /usr/local/lib/python2.7/dist-packages/django/ and /usr/local/lib/python2.7/dist-packages/django/conf/ named pootle.settings leading to my pootle.conf , but still get The SECRET_KEY setting must not be empty . 我尝试将--settings=pootle选项与manage.pydjango-admin.py ,并在/usr/local/lib/python2.7/dist-packages/django//usr/local/lib/python2.7/dist-packages/django/conf/使用符号链接/usr/local/lib/python2.7/dist-packages/django/conf/命名为pootle.settings导致我的pootle.conf ,但仍然得到The SECRET_KEY setting must not be empty

Here the difference is that when you install Pootle via pip, you have available the pootle command, which has a convenience runner that sets things up for you, including the path to the custom settings file. 区别在于,通过pip安装Pootle时,可以使用pootle命令,该命令具有一个便捷运行程序 ,可以为您进行设置,包括自定义设置文件的路径。 When you use a git clone, the convenience magic is unavailable. 当您使用git clone时,便利魔术不可用。

Long story short, you need to set the POOTLE_SETTINGS environment variable to the path of your custom settings file. 简而言之,您需要将POOTLE_SETTINGS环境变量设置为自定义设置文件的路径。

$ POOTLE_SETTINGS=/srv/www/pootle/pootle.conf python manage.py initdb

Alternatively, and since you are trying out a git clone, you can rename your settings file to something like 90-custom-settings-local.conf ( 90- is important, as well as the .conf extension; -local is handy as it's in Pootle's .gitignore ) and drop it into pootle/settings/ , and it'll pick it up. 另外,由于您正在尝试git克隆,因此可以将设置文件重命名为90-custom-settings-local.conf90-很重要,还有.conf扩展名; -local很方便,因为它在Pootle的.gitignore中 )并将其放入pootle / settings / ,然后将其拾取。 No need to set the POOTLE_SETTINGS env var with this method. 无需使用此方法设置POOTLE_SETTINGS

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM