3

这个问题来自 Django 和 Django-cms 菜鸟,他们试图在共享主机帐户上安装 django-cms。这是我到目前为止所做的:

  1. Django 已安装在 ~/.local/lib/python 中(使用 python 2.4.3)

  2. Flup 也安装在同一个地方

  3. 创建了我的应用程序(站点)目录 - ~/.local/lib/python/eck

  4. 下载并解压 django-cms 到 ~/.local/lib/python/eck

  5. 将 cms、mptt 和 publisher 文件夹复制到 ~/.local/lib/python/eck

这就是我卡住的地方。不知道从这里做什么。我应该将示例文件夹的内容复制到 ~/.local/lib/python/eck 并自定义现有的 settings.py 文件吗?其他文件和文件夹呢。我应该将哪些复制到“eck”中?

“example”文件夹下有一个“sampleapp”文件夹。我该怎么办?

谢谢

TIA

4

2 回答 2

1

您是否在没有 Django-CMS 的情况下首次启动并运行 Django?我会先担心这个,然后再担心安装 Django-CMS。你应该能够使用 django-admin.py 命令在你的 webroot 之外的某个地方创建一个项目。然后将您的服务器配置为指向它 - 可能在 Apache 上使用mod_wsgimod_python。我会认为是前者,因为您要安装 wsgi 工具包,但请确保您的共享托管服务提供商已安装 mod_wsgi。

此外,当然我不知道您的托管环境是什么样的,但您不需要在 Python 目录中创建项目。请参阅有关将项目放在何处的答案。

在安装了 Django-CMS 几次之后,在 Django 专业知识的各个级别上,我强烈建议首先专注于让骨架 Django 项目启动并运行!

于 2010-07-02T18:36:22.013 回答
0

I absolutely agree with bennylope's answer -- make sure you have a Django project running before trying to incorporate django-cms.

Once you do have the skeleton django project up, you'll probably want to add this to the bottom of your root urls.py file:

urlpatterns += patterns('',
    url(r'^', include('cms.urls')),
)

In your settings.py file, make sure that you have added the following to INSTALLED_APPS:

    'cms',
    'cms.plugins.text',
    'cms.plugins.picture',
    'cms.plugins.link',
    'cms.plugins.file',
    'cms.plugins.snippet',
    'cms.plugins.googlemap',
    'mptt',
    'menus',
    'publisher',

Don't bother copying over the example folder. However, you do need to set up your starting CMS templates.

In your root project folder, create a folder templates if you haven't already done so. You need to create a file for outputing the CMS, here is a good start:

# default.html
{% extends "base.html" %}
{% load cache cms_tags menu_tags %}
{% block menu %}
<ul id="navigation">
    {% show_menu 0 100 100 100 %} 
</ul>
{% endblock menu %}
{% block content %}
    <ul class="breadcrumb">
        <li class="you">You are here:</li>
        {% show_breadcrumb %}
    </ul>

    <h1>{% block title %}{% page_attribute title %}{% endblock %}</h1>

    <div>
        <div class="placeholder" id="body">
            {% placeholder "body" %}
         </div>
    </div>
{% endblock content %}

Make sure to add

CMS_TEMPLATES = (
        ('default.html', gettext('default')),
)

to your settings file.

You're responsible for setting up base.html. However you write it, make sure it includes {% block content %}{% endblock content %} somewhere so the contents of the CMS template get displayed.

I'd actually recommend against copying the django-cms folders into your /eck directory. They should be located wherever site-packages or the equivalent is located in your install. My favorite way to set this up is to put django-cms in /opt/ and then use symbolic linking to the subfolders in site-packages. This may not work for you, get in touch with whomever manages your shared hosting to ask them what to do, as it is often different for each provider.

However, the key is you don't want to have the django-cms folders in the same area as your project folders. When setting up a django project, I personally like to keep separate the apps I've coded specifically for this project from other apps.

于 2010-10-25T23:20:09.170 回答