小编har*_*der的帖子

使用pip安装pylibmc时出错

您好,当我尝试使用pip在OSX Lion上安装pylibmc时出现以下错误:

./_pylibmcmodule.h:42:10: fatal error: 'libmemcached/memcached.h' file not found

#include <libmemcached/memcached.h>

         ^

1 error generated.

error: command 'clang' failed with exit status 1
Run Code Online (Sandbox Code Playgroud)

如何解决这个问题的任何线索?

python memcached osx-lion libmemcached

63
推荐指数
6
解决办法
2万
查看次数

如何启动Postgres服务器?

我实际上已经有这个问题了一段时间,但我终于决定接受它.Postgres最初是使用Brew安装的.

我升级到OSX 10.8.2后收到一个

psql: could not connect to server: No such file or directory
    Is the server running locally and accepting
    connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
Run Code Online (Sandbox Code Playgroud)

键入时出错

$ psql
Run Code Online (Sandbox Code Playgroud)

命令.

我看到以下过程:

$ ps auxw | grep post
Tulsa           59222   0.0  0.2  2483256  14808   ??  Ss   Thu03PM   0:02.61 /System/Library/PrivateFrameworks/DiskImages.framework/Resources/diskimages-helper -uuid 470DA5CC-1602-4D69-855F-F365A6512F90 -post-exec 4
Tulsa           57940   0.0  0.2  2498852  13648   ??  Ss   Wed10PM   0:00.61 /System/Library/PrivateFrameworks/DiskImages.framework/Resources/diskimages-helper -uuid FAFAAAB4-0F67-42C8-864E-EF8C31A42EE3 -post-exec 4
root            24447   0.0  0.1  2476468  10080   ??  Ss    8Feb13   0:03.40 /System/Library/PrivateFrameworks/DiskImages.framework/Resources/diskimages-helper -uuid …
Run Code Online (Sandbox Code Playgroud)

postgresql osx-lion django-postgresql

22
推荐指数
1
解决办法
3万
查看次数

Django无法找到模板

所以我一直在尝试设置一个django设置模块,它将检查环境变量和加载设置.

下面是我的设置模块的样子

/templates
    home.html

/settings
    base.py
    prod.py
    dev.py
    test.py
Run Code Online (Sandbox Code Playgroud)

base.py

PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__))

TEMPLATE_DIRS = [
os.path.join(PROJECT_ROOT, "templates"),
]

urls.py

from django.views.generic.simple import direct_to_template

urlpatterns = patterns('',
url(r"^$", direct_to_template, {'template' : 'home.html' }, name="home"),
)
Run Code Online (Sandbox Code Playgroud)

当我将所有设置放在一个文件中时,这工作得很好,但是因为我将文件拆分了,所以我得到错误:

TemplateDoesNotExist at /

home.html

Template-loader postmortem

Django tried loading these templates, in this order:
Using loader django.template.loaders.filesystem.Loader:
/Users/Tulsa/Apps/tulsa-applications-co/tulsa/tulsa/settings/templates/home.html (File does not exist)
Using loader django.template.loaders.app_directories.Loader:
/Users/Tulsa/.Apps/tulsa_io/lib/python2.7/site-packages/django/contrib/auth/templates/home.html (File does not exist)
/Users/Tulsa/.Apps/tulsa_io/lib/python2.7/site-packages/django/contrib/admindocs/templates/home.html (File does not exist)
/Users/Tulsa/.Apps/tulsa_io/lib/python2.7/site-packages/grappelli/templates/home.html (File does not exist)
/Users/Tulsa/.Apps/tulsa_io/lib/python2.7/site-packages/django/contrib/admin/templates/home.html (File does not …
Run Code Online (Sandbox Code Playgroud)

django django-templates django-settings

1
推荐指数
1
解决办法
4169
查看次数

Django 1.5升级后STATIC_URL无法正常工作

我可能只是累了,并没有注意到这里明显的东西,但升级到Django 1.5后,我的静态文件的路径被打破.

settings.py

from os.path import abspath, basename, dirname, join, normpath

SITE_ROOT = dirname(dirname(abspath(__file__)))

SITE_NAME = basename(SITE_ROOT)

PROJECT_ROOT = dirname(SITE_ROOT)

STATIC_ROOT = normpath(join(SITE_ROOT, 'static', 'site_media'))

STATIC_URL = "/site_media/static/"

STATICFILES_FINDERS = (
    "staticfiles.finders.FileSystemFinder",
    "staticfiles.finders.AppDirectoriesFinder",
    "staticfiles.finders.LegacyAppDirectoriesFinder",
    "compressor.finders.CompressorFinder",
Run Code Online (Sandbox Code Playgroud)

)

的index.html

    <link rel="stylesheet" href="{{ STATIC_URL }}css/site_base.css" />
Run Code Online (Sandbox Code Playgroud)

django django-settings django-staticfiles

1
推荐指数
1
解决办法
2641
查看次数