Code Monkey home page Code Monkey logo

spirit's Introduction

Spirit

Build Status Coverage Status pypi licence

Spirit is a Python based forum built using the Django framework.

Documentation

Docs can be found at spirit.readthedocs.io

Compatibility

  • Python 3.8, 3.9, 3.10, and 3.11 (recommended)
  • Django 3.2 LTS, and 4.2 LTS
  • PostgreSQL (recommended), MySQL, Oracle Database and SQLite

Constrained by "What Python version can I use with Django?"

Usage

New in Spirit 0.5

pip install django-spirit
spirit startproject mysite
cd mysite
python manage.py spiritinstall
python manage.py createsuperuser
python manage.py runserver

Visit http://127.0.0.1:8000

For detailed setup docs, see spirit.readthedocs.io

Testing

python runtests.py

License

MIT

spirit's People

Contributors

alesdotio avatar andreav avatar andreynovikov avatar benmurden avatar code-review-doctor avatar cryptogun avatar defp avatar initialkommit avatar mdamien avatar nitely avatar nitely-throwaway777 avatar rkenmi avatar robertkolner avatar sheepsy90 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

spirit's Issues

Extending RegistrationForm

I wanted to extend RegistrationForm to include a captcha field. What I ended up needing to do was to copy the register view and change the RegistrationForm class used to a custom form.

I think it would be better if you could specify the RegistrationForm class as an optional argument to register. Then you would only need to define your custom form and add a url entry that passed the extra argument.

Alternatively, if there is already an easy way to do this, maybe you could add an example?
Thanks!

Integration into Another App

We are trying to integrate Spirit into a larger website to not only add a separate forum section, but to also put comments at the bottom of several pages. The big problem is embedding the topic detail, along with the comment edit box, into one of our own pages. All the templates and URLs and views seem to assume that Spirit owns the top-level page, POSTing to a Spirit URL which is unaware that we need a different page rendered after the submission. The only way I currently see is to copy all the Spirit views we need, modify them to include the additional context information we need for each page, then override the template. That's a lot of code copying and/or a hard fork of Spirit.

Any ideas on a better way this could be done? Or is Spirit just meant to be a standalone app only?

Using Spirit with an existing site that uses Userena

I see in the instructions that:

If you want to roll your own user app, your user model must inherit from spirit.models.user.AbstractForumUser.

I'm still fairly new to django and am not exactly sure what is meant by this? Possible for you to provide an example of how i could integrate it with an existing site that uses Userena?

Having trouble adding django-spirit to an exisiting mezzanine website

I am tying to integrate django-spirit into an existing mezzanine website on windows.

I followed the following instructions:
https://github.com/nitely/Spirit/blob/master/README.md

When i launch the website now I get the following error:

Exception Value:
Cannot create form field for 'category' yet, because its related model u'spirit_category.Category' has not been loaded yet

Any ideas on how to get this resolved and move forward with the integration. Appreciate the inputs.

Thanks,
Nirmala

RelatedObjectDoesNotExist while integrating Spirit to existing project: "User has no st."

Hi!
I'm trying to add the latest version of spirit to an existing project. I installed the dependencies and all, but when I run the server, I get a «RelatedObjectDoesNotExist» - User has no st on every page.

It appears that it is because I already have users in my database, so I'm going to add them a placeholder UserProfile via the manage.py shell…

But is there a more efficient/recommended/documented way to do it?

Test: no such table: spirit_autoslugmodel

When I run the django test i got that the table for autoslugmodel does not exist in the db, I already found in Travis CI that you have this issue in this build and you fix it with a deconstructor function, so I pull the commits into my repo but the issue persists. Any suggestions ?

Search won't search in comments

I did

$ python manage.py rebuild_index --noinput
Removing all documents from your index because you said so.
All documents removed.
Indexing 3 topics
$ python manage.py runserver 0:8001
Performing system checks...

System check identified no issues (0 silenced).
July 06, 2015 - 18:18:18
Django version 1.7.8, using settings 'forum.settings'
Starting development server at http://0:8001/
Quit the server with CONTROL-C.
/local/lib/python2.7/site-packages/django/template/base.py:290: RemovedInDjango18Warning: 'The `firstof` template tag is changing to escape its arguments; the non-autoescaping version is deprecated. Load it from the `future` tag library to start using the new behavior.
  compiled_result = compile_func(self, token)

[06/Jul/2015 18:18:32] "GET /search/?q=Wowo HTTP/1.1" 200 5796

Results

There are no search results.

LookupError: No installed app with label 'spirit'.

Wanted to test setting up spirit in a fresh django app to mess around with it to see if it would work in an existing project.

I get the following error when trying to migrate:

root@boot2docker:~/testforum# ./manage.py migrate
Traceback (most recent call last):
  File "./manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 377, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 288, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 337, in execute
    self.check()
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 371, in check
    all_issues = checks.run_checks(app_configs=app_configs, tags=tags)
  File "/usr/local/lib/python2.7/dist-packages/django/core/checks/registry.py", line 59, in run_checks
    new_errors = check(app_configs=app_configs)
  File "/usr/local/lib/python2.7/dist-packages/django/contrib/auth/checks.py", line 12, in check_user_model
    cls = apps.get_model(settings.AUTH_USER_MODEL)
  File "/usr/local/lib/python2.7/dist-packages/django/apps/registry.py", line 202, in get_model
    return self.get_app_config(app_label).get_model(model_name.lower())
  File "/usr/local/lib/python2.7/dist-packages/django/apps/registry.py", line 150, in get_app_config
    raise LookupError("No installed app with label '%s'." % app_label)
LookupError: No installed app with label 'spirit'.

Steps I took (can reproduce multiple times):

#django-admin startproject testforum
#pip install django-spirit 
- Added url(r'^', include('spirit.urls')), to urls.py
- Added from spirit.settings import * to the top of  settings.py file
#./manage.py migrate

Running django 1.7 w/ python 2.7, here's the versions of everything else:

Django==1.7
Pillow==2.6.2
Whoosh==2.5.7
argparse==1.2.1
chardet==2.0.1
colorama==0.2.5
django-debug-toolbar==1.3.0
django-djconfig==0.3.2
django-haystack==2.3.1
django-infinite-scroll-pagination==0.1.3
django-spirit==0.2.1
html5lib==0.999
mistune==0.3.1
pytz==2015.2
requests==2.2.1
six==1.5.2
sqlparse==0.1.15
urllib3==1.7.1
wheel==0.24.0
wsgiref==0.1.2

I can clone the repository and get the example to work, so I am unsure as to why it wont work in a fresh app. The only documentation I could find was the readme, so I would appreciate some help (or point me to any other documentation if it exist)

Replace custom user mgmt with Spirit's

Hey again! It's been a while :p

So I'm ready to integrate Spirit in my project. In doing so, I'd like to use the user management you wrote as mine was only a temporary solution meant for local purposes only. I'm not sure how to go about replacing it, though - I've tried importing your views for logging in but then I get a template error on registration/login.html. How would one go about doing this?

Many thanks in advance!

mistune improvement

Hi, I am the author of mistune. I found those audio_link, image_link etc in BlockLexer. Is there any particular reason that they should be in a lexer?

I think it would be a simple renderer like this:

class LinkRenderer(mistune.Renderer):
    def autolink(self, link, is_email=False):
        if is_email:
            return 'email link'
        if is_youtube(link):
            return 'youtube html'
        if is_audio(link):
            return 'audio html'
        ...

Django fails to find 'spirit.User'

I've installed Spirit using pip and added it to my INSTALLED_APPS. Having done so, Django fails to find the 'spirit.User' model:

(project) ± python manage.py shell_plus --settings=project.settings.local
CommandError: One or more models did not validate:
auth.user: Model has been swapped out for 'spirit.User' which has not been installed or is abstract.
admin.logentry: 'user' has a relation with model spirit.User, which has either not been installed or is abstract.

TypeError at yt_paginator.py

I just noticed something strange at yt_paginator.py, line 36.
A TypeError was throwed at line 36 with the message "unsupported operand type(s) for *: 'int' and 'NoneType'".

It happened just after the installation, while I was creating the first categories.
I fixed with an ugly

if not number: number = 1

Is it a real issue?

Update info on django packages and additional details

Hello,

thank you for this great piece of software! I've just implemented and wrote a guide.

Anyway, I'm writing that it might be helpful to update djangopackages about ability to handle polls and comments in Spirit.

By the way - is there a reason why you test only with Pillow<2.7 or so? I'm happily using spirit with Pillow 2.8.1 withou problems. I'm also using it with Django 1.8.1 (I used the experimental branch).

Additionally, no documentation at all can be found about spirit. Not even for users of spirit. Some help button on the site would be appreciated. There users could learn about markdown, emoticons, avatars, private topics etc.

Even I, as a developer, don't know what are the possibilities of this forum. For example I wanted to insert google analytics code to _footer.html, but I wasn't able to override the default one from virtualenv...

Thank you

Cannot find login view after password reset

Here's a patch

diff --git a/spirit/templates/spirit/user/password_reset_complete.html b/spirit/templates/spirit/user/password_reset_complete.html
index cc1965a..77f4aa7 100644
--- a/spirit/templates/spirit/user/password_reset_complete.html
+++ b/spirit/templates/spirit/user/password_reset_complete.html
@@ -10,6 +10,6 @@

     <h1 class="headline">{% trans 'Password change successful' %}</h1>

-    <p><a href="{% url "login" %}">{% trans 'Continue to login' %}</a></p>
+    <p><a href="{% url "spirit:user-login" %}">{% trans 'Continue to login' %}</a></p>

-{% endblock %}
\ No newline at end of file
+{% endblock %}

Django fails to find 'spirit.User'

I've installed Spirit from from both git and pip and tried following the instructions @ installing-advanced. In both cases the install fails at the syncdb step.

$ python manage.py syncdb
CommandError: One or more models did not validate:
admin.logentry: 'user' has a relation with model spirit.User, which has either not been installed or is abstract.
auth.user: Model has been swapped out for 'spirit.User' which has not been installed or is abstract.

ImportError: No module named Category

Hey guys! I've been looking into a few Django forums for an app I'm developing when I stumbled upon Spirit. I (and the other members of the team) love the way it looks, as well as the many functionalities it offers. However, after installing Spirit (both through pip install django-spirit and pip install -r requirements.txt), I can't run my migrations or my server because I'm getting an ImportError. This is the traceback:
Traceback (most recent call last):
File "manage.py", line 10, in
execute_from_command_line(sys.argv)
File "/usr/local/lib/python3.4/dist-packages/django/core/management/init.py", line 385, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python3.4/dist-packages/django/core/management/init.py", line 354, in execute
django.setup()
File "/usr/local/lib/python3.4/dist-packages/django/init.py", line 21, in setup
apps.populate(settings.INSTALLED_APPS)
File "/usr/local/lib/python3.4/dist-packages/django/apps/registry.py", line 108, in populate
app_config.import_models(all_models)
File "/usr/local/lib/python3.4/dist-packages/django/apps/config.py", line 202, in import_models
self.models_module = import_module(models_module_name)
File "/usr/lib/python3.4/importlib/init.py", line 109, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 2231, in _gcd_import
File "", line 2214, in _find_and_load
File "", line 2203, in _find_and_load_unlocked
File "", line 1200, in _load_unlocked
File "", line 1129, in _exec
File "", line 1448, in exec_module
File "", line 321, in _call_with_frames_removed
File "/usr/local/lib/python3.4/dist-packages/spirit/models/init.py", line 1, in
from category import Category
ImportError: No module named 'category'

Do you have any clue what might be causing this? Many thanks in advance!

type object 'BlockLexer' has no attribute 'default_features'

AttributeError at /topic
type object 'BlockLexer' has no attribute 'default_features'
Request Method: GET
Request URL: http://127.0.0.1:8000/topic
Django Version: 1.8
Exception Type: AttributeError
Exception Value:
type object 'BlockLexer' has no attribute 'default_features'
Exception Location: C:\Python27\lib\site-packages\spirit\core\utils\markdown\block.py in BlockLexer, line 97
Python Executable: C:\Python27\python.exe
Python Version: 2.7.8
Python Path:
['C:\Users\Robert\Desktop\forum\forum',
'C:\Python27\lib\site-packages\xlrd-0.9.3-py2.7.egg',
'C:\Python27\lib\site-packages\pip-1.5.6-py2.7.egg',
'C:\Python27\python27.zip',
'C:\Python27\DLLs',
'C:\Python27\lib',
'C:\Python27\lib\plat-win',
'C:\Python27\lib\lib-tk',
'C:\Python27',
'C:\Python27\lib\site-packages']
Server time: Sat, 17 Oct 2015 15:51:59 +0000

That is the issue that i am getting when i am using this app with my production enviorment any ideas why?

Error sending e-mail after registration

Hi there,

I'm getting this error

No handlers could be found for logger "spirit.utils.user.email"

on apache's log, after completing a registration.

I've configured the e-mail settings, are there any other dependencies?

I'm using an external e-mail provider, by the way.

Thanks in advance

Basic config broken

When attempting to make basic config edits at site.com/st/admin/config/basic/ I am confronted with this error:

Exception Value:
no such table: djconfig_config

ImportError: No module named 'spirit'

I got 'spirit' by 'git clone', and then follow instructions in README.md. Then I got this error. I know this about 'PYTHONPATH'. And I got the solution by make an soft link in PYTHONPATH. So I think it maybe a document issue.

post anonymously

is there any way to use spirit without the need to log in to the site and still be able to post..?

thanks

Google Analytics snippet.

Hi,

I'd like to be able to easily add a Google Analytics snippet to my forum from the admin page. Would this be possible to implement?

Import spirit in project with another user_model

For testing purposes, I changed the spirit example project adding a user app which defines a user_model called TestUser. When I set AUTH_USER_MODEL = 'user.TestUser,

./manage.py makemigrations outputs:

Migrations for 'user':
  0001_initial.py:
    - Create model TestUser
Migrations for 'spirit':
  0003_auto_20141218_0910.py:
    - Alter field slug on category
    - Alter field slug on topic
    - Alter field slug on user
    - Alter field timezone on user
    - Alter field username on user

But I can't run ./manage.py makemigrations , I got this error.

...
  Applying spirit.0001_initial...Traceback (most recent call last):
  File "/media/home/ben/.miniconda3/envs/spirit/lib/python3.4/site-packages/django/apps/registry.py", line 148, in get_app_config
    return self.app_configs[app_label]
KeyError: 'user'
...
LookupError: No installed app with label 'user'.
...
ValueError: Lookup failed for model referenced by field spirit.CommentLike.user: user.TestUser

The only way I can run migrations is to delete spirit.0001_ and spirit.0002_ migrations and make a new one with ./manage.py makemigrations, but you told me I shouldn't do that.

Unread comments count for each topic

After a quick look at the code would it be possible to use the CommentBookmark to find out how many unread comments are there for each topic? Do you think it would make sense to show this number next to the total number of comments?

Need auto-generate meta description and seo stuff

Spirit is a super clean and modern forum software. However, it needed to be SEO friendly too. This can be done by adding canonical tags to all pages, no-index but follow tag for necessary pages such as sub-pages (page=2, etc) and an auto-generate meta description according to the content of that post instead of forum homepage description.

Remove SVG font workaround for chrome

This workaround is causing some issues in select widgets on chrome (see chrome issue #290414) and SVG font support may be depreciated in chrome soon.

I know it was intended as a workaround for chrome's poor font rendering, but they've made significant progress on that end and I think the current rendering is acceptable and preferable over the gibberish select widgets.

EDIT: Just wanted to note, the gibberish select widgets are occurring on any project I run, but your community forums seem to not use the workaround and are unaffected.

Restrict access, commenting, or creating topics in a category

Hi @nitely! Thanks for the great software 🌟, really made my life much easier!

I am implementing a forum based on Spirit and was wondering if you had any plans of having restrictions on categories? I think it would make sense to be able to have categories with special rules as to who can see/access them, who can create topics and who can comment. This would allow you to have private categories for only a selected few, for example a "Moderators" category; or a "Announcements" category where only admins can create topics, but everyone can comment, etc.

If you already had some ideas on how you want to do this, let me know. I will be implementing this in my fork shortly and it would be cool if we can come up with a solution that can be merged in. I think using the django.contrib.auth groups would make the most sense in this case and I would add 3 M2M fields to Category. Something like:

  • restrict_access
  • restrict_create_topic
  • restrict_create_comment

Integration of Spirit in Mezzanine

I try to integrate Spirit with the Mezzanine CMS.
But I'm not able to use the AUTH model of ezzanine in Spirit.
Now I try the Spirit-User-Profile app and I get following error:

django.contrib.admin.sites.AlreadyRegistered: The model User is already registered

Actually I'm stuck. It's my first Django project.
Maybe the problem is, that Mezzanine still uses Django’s AUTH_PROFILE_MODULE setting to create custom user profiles.

It would really be nice if Spirit could integrate in Mezzanine.
They're both great projects.

Overriding templates

Is there a recommended way to override the spirit templates? I'm adding a Spirit forum to an existing website and would like the navbars to look the same, etc.

Error: Cannot create form field for 'category' yet (Windows)

Thank you for this open source forum.Really helpful

I've trying to install it using the readme on the front page, through pip, cloned it, used the example, also tried this #73.

These seems to be some errors while python manage.py runserver. I'm using windows and django==1.8.

This is one of the error I keep getting:

Cannot create form field for 'category' yet, because its related model u'spirit_category.Category' has not been loaded yet

I got stuck here for days.So,if you could please take time to explain the step-wise installation procedure, it would be helpful to me.
I appreciate that.
Thank you so much.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.