需要帮助安装 django-cms

发布于 2024-08-30 00:18:17 字数 580 浏览 2 评论 0原文

这个问题来自一位 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

This question is from a Django and Django-cms rookie attempting to install django-cms on a shared hosting account. Here's what I have done so far:

  1. Django has been installed in ~/.local/lib/python (using python
    2.4.3)

  2. Flup has also been installed in same place

  3. Created my app (site) directory - ~/.local/lib/python/eck

  4. downloaded and extracted django-cms into ~/.local/lib/python/eck

  5. Copied the cms, mptt, and publisher folders into ~/.local/lib/
    python/eck

That's where I'm stuck. Not sure what to do from here. Should I copy
the contents of the example folder into ~/.local/lib/python/eck and
customize the existing settings.py file? What about the other files and folders. Which ones should I copy into "eck?"

There is a "sampleapp" folder under the "example" folder. What do I do with that?

Thanks

TIA

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

不…忘初心 2024-09-06 00:18:17

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

另外,我不知道您的托管环境是什么样的,但您不需要在 Python 目录中创建项目。请参阅此答案,了解在哪里放置您的项目

在安装了 Django-CMS 几次之后,在 Django 技术的不同水平上,我强烈建议首先专注于建立和运行一个 Django 项目框架!

Have you first gotten Django up and running, without Django-CMS? I'd worry about that first, and then worry about getting Django-CMS installed. You should be able to create a project somewhere outside of your webroot using the django-admin.py commands. Then configure your server to point to it - probably on Apache with either mod_wsgi or mod_python. I would think the former since you're installing a wsgi tools bundle, but make sure you shared hosting provider has mod_wsgi installed.

Also, granted I don't know what your hosting environment is like, but you shouldn't need to create your project in your Python directory. See this answer about where to put your project.

Having installed Django-CMS a couple times, at various levels of Django know-how, I would strongly suggest focusing on getting a skeleton Django project up and running first!

从﹋此江山别 2024-09-06 00:18:17

我完全同意 bennylope 的回答 - 确保你有一个 Django在尝试合并 django-cms 之前运行项目。

一旦您建立了 django 项目框架,您可能需要将其添加到根 urls.py 文件的底部:

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

在您的 settings.py 文件中,确保您已将以下内容添加到 INSTALLED_APPS 中:

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

不必费心复制示例文件夹。但是,您确实需要设置起始 CMS 模板。

在您的根项目文件夹中,创建一个文件夹 templates(如果您尚未这样做)。您需要创建一个用于输出 CMS 的文件,这是一个好的开始:

# 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 %}

确保添加

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

到您的设置文件中。

您负责设置 base.html。无论您如何编写,请确保它在某处包含 {% block content %}{% endblock content %} ,以便显示 CMS 模板的内容。

我实际上建议不要将 django-cms 文件夹复制到 /eck 目录中。它们应该位于您安装中的 site-packages 或等效内容的任何位置。我最喜欢的设置方法是将 django-cms 放入 /opt/ 中,然后使用符号链接到 site-packages 中的子文件夹。这可能不适合您,请与管理您的共享主机的人员联系,询问他们该怎么做,因为每个提供商的情况通常有所不同。

但是,关键是您不希望 django-cms 文件夹与项目文件夹位于同一区域。在设置 django 项目时,我个人喜欢将专门为此项目编码的应用程序与其他应用程序分开。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文