barrysteyn / pelican_plugin-render_math

A plugin for the pelican blog to allow it render mathematics in Latex.
67 stars 25 forks source link

Installation issue #31

Closed ankush981 closed 8 years ago

ankush981 commented 8 years ago

Hi, I'm not able to get this work properly. Some guidance, please. :smile:

What I did was clone the repo into a directory called plugin_render_math so that my website directory now looks like this:

content
fabfile.py  output          
plugin_render_math  
__pycache__  
venv
develop_server.sh  
Makefile    
pelicanconf.py  
publishconf.py      
themes

Then I added this to pelicanconf.py:

from plugin_render_math import render_math
PLUGINS = ['render_math']

Now when I finally do pelican content, I get this error:

ImportError: No module named 'plugin_render_math'

I tried to fix this by changing the line in pelicanconf.py to from .plugin_render_math import render_math but this gave the following error:

SystemError: Parent module '' not loaded, cannot perform relative import

I understand I'm making a silly Python mistake somewhere, but I can't figure out where. Please help a bit?

dandavison commented 8 years ago

Hi @ankush981 I'm totally new to pelican but this worked for me as follows:

  1. create a directory "plugins" at the top level of your pelican project
  2. Add the following to pelicanconf.py:

    PLUGIN_PATHS = ['plugins']
    PLUGINS = ['render_math']
  3. Clone this repo (pelican_plugin-render_math) somewhere and put a symlink in your "plugins" directory. The symlink should be called "render_math" and it should point to your clone of this repo.

So here's what the structure of my pelican project looks like now:

.
├── Makefile
├── pelicanconf.py
├── plugins
│   └── render_math -> ../../../pelican_plugin-render_math
└── publishconf.py

As an alternative to creating a "plugins" directory ourselves and populating it with plugins, it looks like we could also use https://github.com/getpelican/pelican-plugins as the "plugins" directory.

ankush981 commented 8 years ago

@dandavison Thanks for your answer! I was eventually able to make it work by installing the pelican plugins bundle (can't find the link now) and following their instructions. :)