hovel / pybbm

Django forum solution. Tested, documented, shipped with example project.
BSD 2-Clause "Simplified" License
225 stars 152 forks source link

pybb with django 1.8.2 #186

Closed auvipy closed 8 years ago

auvipy commented 9 years ago

WARNINGS: pybb.Forum.moderators: (fields.W340) null has no effect on ManyToManyField. pybb.Post.user_ip: (fields.W900) IPAddressField has been deprecated. Support for it (except in historical migrations) will be removed in Django 1.9. HINT: Use GenericIPAddressField instead.

auvipy commented 9 years ago

TemplateDoesNotExist at /forum/ base.html Request Method: GET Request URL: http://127.0.0.1:8000/forum/ Django Version: 1.8.2 Exception Type: TemplateDoesNotExist Exception Value:
base.html Exception Location: /home/asif/.pyenv/versions/3.4.3/lib/python3.4/site-packages/django/template/engine.py in find_template, line 146 Python Executable: /home/asif/.pyenv/versions/3.4.3/bin/python Python Version: 3.4.3 Python Path:
['/home/asif/P/swing/swingthat', '/home/asif/.pyenv/versions/3.4.3/lib/python34.zip', '/home/asif/.pyenv/versions/3.4.3/lib/python3.4', '/home/asif/.pyenv/versions/3.4.3/lib/python3.4/plat-linux', '/home/asif/.pyenv/versions/3.4.3/lib/python3.4/lib-dynload', '/home/asif/.pyenv/versions/3.4.3/lib/python3.4/site-packages'] Server time: Sun, 28 Jun 2015 06:07:23 +0000 Template-loader postmortem

Django tried loading these templates, in this order: Using loader django.template.loaders.filesystem.Loader: Using loader django.template.loaders.app_directories.Loader: /home/asif/.pyenv/versions/3.4.3/lib/python3.4/site-packages/material/admin/templates/base.html (File does not exist) /home/asif/.pyenv/versions/3.4.3/lib/python3.4/site-packages/django/contrib/admin/templates/base.html (File does not exist) /home/asif/.pyenv/versions/3.4.3/lib/python3.4/site-packages/django/contrib/auth/templates/base.html (File does not exist) /home/asif/.pyenv/versions/3.4.3/lib/python3.4/site-packages/material/templates/base.html (File does not exist) /home/asif/.pyenv/versions/3.4.3/lib/python3.4/site-packages/material/frontend/templates/base.html (File does not exist) /home/asif/.pyenv/versions/3.4.3/lib/python3.4/site-packages/easy_pjax/templates/base.html (File does not exist) /home/asif/.pyenv/versions/3.4.3/lib/python3.4/site-packages/pybb/templates/base.html (File does not exist) Error during template rendering

In template /home/asif/.pyenv/versions/3.4.3/lib/python3.4/site-packages/pybb/templates/pybb/base.html, error at line 1 base.html 1

  {% extends PYBB_TEMPLATE|default:"base.html" %}

2
3 {% load url from future %} 4
5 {% load i18n pybb_tags %} 6
7 {%block title %}{{ PYBB_DEFAULT_TITLE }}{% endblock title %} 8
9 {% block extra_head %} 10 {{ block.super }} 11

auvipy commented 9 years ago

how to solve this?

Template-loader postmortem

Django tried loading these templates, in this order: Using loader django.template.loaders.filesystem.Loader: Using loader django.template.loaders.app_directories.Loader: /home/asif/.pyenv/versions/3.4.3/lib/python3.4/site-packages/material/admin/templates/base.html (File does not exist) /home/asif/.pyenv/versions/3.4.3/lib/python3.4/site-packages/django/contrib/admin/templates/base.html (File does not exist) /home/asif/.pyenv/versions/3.4.3/lib/python3.4/site-packages/django/contrib/auth/templates/base.html (File does not exist) /home/asif/.pyenv/versions/3.4.3/lib/python3.4/site-packages/material/templates/base.html (File does not exist) /home/asif/.pyenv/versions/3.4.3/lib/python3.4/site-packages/material/frontend/templates/base.html (File does not exist) /home/asif/.pyenv/versions/3.4.3/lib/python3.4/site-packages/easy_pjax/templates/base.html (File does not exist) /home/asif/P/swing/swingthat/pybb/templates/base.html (File does not exist) Error during template rendering

In template /home/asif/P/swing/swingthat/pybb/templates/pybb/base.html, error at line 1

skolsuper commented 9 years ago

Hi Asif, the pybb package assumes the presence of a base.html template in your project, but does not provide one. You can either add one in a templates folder in one of your apps, where it will be found by django.template.loaders.app_directories.Loader, or add a new templates folder somewhere and add it to your TEMPLATES['DIRS'] in settings, e.g.:

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [os.path.join(BASE_DIR, 'my_templates')],
        'APP_DIRS': True,
        'OPTIONS': {
            # ... some options here ...
        },
    },
]

I think all it needs is some <html> tags and a {% block content %}{% endblock %}, but you should check that because I'm not sure I'm remembering correctly and I can't check my own at the minute.

skolsuper commented 9 years ago

Or you can use PYBB_TEMPLATE in settings to set something other than base.html as your base template.

auvipy commented 9 years ago

but there is a base.html file in pybb/templates folder

skolsuper commented 9 years ago

Check again, I bet it's in pybb/templates/pybb/base.html. That would make it pybb/base.html in the templates namespace

auvipy commented 9 years ago

yeah you are right i found it there.

auvipy commented 9 years ago

well there should be any global project template dir then?

auvipy commented 9 years ago

{% extends PYBB_TEMPLATE|default:"base.html" %}

{% load url from future %}

{% load i18n pybb_tags %}

{% block title %}{{ PYBB_DEFAULT_TITLE }}{% endblock title %}

{% block extra_head %} {{ block.super }}

<link rel="alternate" type="application/atom+xml" href="{% url 'pybb:feed_posts' %}" title="{% trans "Latest posts on forum" %}" >
<link rel="alternate" type="application/atom+xml" href="{% url 'pybb:feed_topics' %}" title="{% trans "Latest topics on forum" %}" >

{% endblock %}

{% block breadcrumb %} {% include "pybb/breadcrumb.html" %} {% endblock %}

{% block content %}{% endblock content %}

this is already provided with pybb. so why still template doesnt exist?

skolsuper commented 9 years ago

That is pybb/base.html, it needs a plain base.html to inherit from ("extend"). Put the following in a base.html file in the templates folder of any one of your apps:

<html>
<head>
<title>{% block title %}{% endblock %}</title>
</head>
<body>
{% block breadcrumbs %}{% endblock %}
{% block content %}{% endblock %}
</body>
</html>
auvipy commented 9 years ago

thank you :)

auvipy commented 9 years ago

when i go to add new catagory this appears

ValidationError at /admin/pybb/category/add/ ['ManagementForm data is missing or has been tampered with'] Request Method: POST Request URL: http://127.0.0.1:8000/admin/pybb/category/add/ Django Version: 1.8.2 Exception Type: ValidationError Exception Value:
['ManagementForm data is missing or has been tampered with']

hrishikesh94 commented 8 years ago

auvipy, how did you manage to resolve the initial error : pybb.Forum.moderators: (fields.W340) null has no effect on ManyToManyField. pybb.Post.user_ip: (fields.W900) IPAddressField has been deprecated. Support for it (except in historical migrations) will be removed in Django 1.9. HINT: Use GenericIPAddressField instead. Im facing this error ^^ while trying to make migrations

auvipy commented 8 years ago

I was unable to fix and didn't have enough time to fix, so didn't use pybbm in my project.

But to fix you problem, you need to patch on pybb models and find out the classes of related models and edit the field's there. If I were you I would try to solve it that way.

lampslave commented 8 years ago

django 1.9 supported since cfb66d51fbaa156ddb866cf06f773c3ccdceffe7