getpelican / pelican

Static site generator that supports Markdown and reST syntax. Powered by Python.
https://getpelican.com
GNU Affero General Public License v3.0
12.5k stars 1.81k forks source link

wrong path to image #975

Closed PhML closed 10 years ago

PhML commented 11 years ago

With the following content:

.. image:: /images/DSC_0702_v1.TIFF

`a link relative to content root <|filename|/images/DSC_0702_v1.TIFF>`_

.. image:: images/DSC_0702_v1.TIFF

.. image:: |DSC_0761.JPG|/images/DSC_0761.JPG

I have the link working well, but no image. make servdev says:

127.0.0.1 - - [26/Jul/2013 15:21:21] code 404, message File not found
127.0.0.1 - - [26/Jul/2013 15:21:21] "GET /images/DSC_0702_v1.TIFF HTTP/1.1" 404 -

And in the final html file:

</footer><!-- /.post-info -->      <img alt="/images/DSC_0702_v1.TIFF" src="/images/DSC_0702_v1.TIFF" />
<p><a class="reference external" href="./static/images/DSC_0702_v1.TIFF">a link relative to content root</a></p>

we can see that for the image, the path is /images… while for the like it is well ./static/images…

With Pelican 3.2.2 and python 2.7.5.

justinmayer commented 11 years ago

Do you have RELATIVE_URLS set to True?

As an aside, the /static/ path handling was improved in #795, which is present in current master and due to be included in the next Pelican release.

justinmayer commented 11 years ago

Hi @PhML. Is there anything further we can do to assist you with this?

PhML commented 11 years ago

I tried with and without RELATIVE_URLS set to True, it changes nothing. I tried to install pelican from source, but I obtain an error:

pip install -e git://github.com/getpelican/pelican#egg=pelican
fatal: read error: Connection reset by peer
fatal: early EOF
fatal: index-pack failed
Obtaining pelican from git+git://github.com/getpelican/pelican#egg=pelican
  Cloning git://github.com/getpelican/pelican to ./src/pelican
  Complete output from command /usr/bin/git clone -q git://github.com/getpelican/pelican /home/phml/virtualenvs/pelican-git/src/pelican:

----------------------------------------
Command /usr/bin/git clone -q git://github.com/getpelican/pelican /home/phml/virtualenvs/pelican-git/src/pelican failed with error code 128 in None
Storing complete log in /home/phml/.pip/pip.log

and content of pip.log:

/home/phml/virtualenvs/pelican-git/bin/pip run on Tue Jul 30 01:16:57 2013
Obtaining pelican from git+git://github.com/getpelican/pelican#egg=pelican

Cloning git://github.com/getpelican/pelican to ./src/pelican

Found command 'git' at '/usr/bin/git'
Running command /usr/bin/git clone -q git://github.com/getpelican/pelican /home/phml/virtualenvs/pelican-git/src/pelican
Complete output from command /usr/bin/git clone -q git://github.com/getpelican/pelican /home/phml/virtualenvs/pelican-git/src/pelican:

----------------------------------------

Command /usr/bin/git clone -q git://github.com/getpelican/pelican /home/phml/virtualenvs/pelican-git/src/pelican failed with error code 128 in None

Exception information:
Traceback (most recent call last):
File "/home/phml/virtualenvs/pelican-git/lib/python2.7/site-packages/pip-1.3.1-py2.7.egg/pip/basecommand.py", line 139, in main
    status = self.run(options, args)
File "/home/phml/virtualenvs/pelican-git/lib/python2.7/site-packages/pip-1.3.1-py2.7.egg/pip/commands/install.py", line 266, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File "/home/phml/virtualenvs/pelican-git/lib/python2.7/site-packages/pip-1.3.1-py2.7.egg/pip/req.py", line 1003, in prepare_files
    req_to_install.update_editable(not self.is_download)
File "/home/phml/virtualenvs/pelican-git/lib/python2.7/site-packages/pip-1.3.1-py2.7.egg/pip/req.py", line 395, in update_editable
    vcs_backend.obtain(self.source_dir)
File "/home/phml/virtualenvs/pelican-git/lib/python2.7/site-packages/pip-1.3.1-py2.7.egg/pip/vcs/git.py", line 112, in obtain
    call_subprocess([self.cmd, 'clone', '-q', url, dest])
File "/home/phml/virtualenvs/pelican-git/lib/python2.7/site-packages/pip-1.3.1-py2.7.egg/pip/util.py", line 662, in call_subprocess
    % (command_desc, proc.returncode, cwd))
InstallationError: Command /usr/bin/git clone -q git://github.com/getpelican/pelican /home/phml/virtualenvs/pelican-git/src/pelican failed with error code 128 in None
justinmayer commented 11 years ago

Hmm. Not sure what's causing that error. Perhaps you might instead try the method described in our Setting Up the Development Environment instructions.

kylef commented 11 years ago

The command works for me, perhaps your version of git is before they supported repositories without the .git suffix. Try pip install -e http://github.com/getpelican/pelican.git#egg=pelican.

justinmayer commented 11 years ago

I took the liberty of adjusting the pip editable URL in the docs via 4c1b5c3.

PhML commented 11 years ago

I installed from the Setting Up the Development Environment instructions, it worked. But still no images on my pages. I am the only one for whom it does not work?

It tried to install on another computer via pip (both pip install pelican and pip install -e git://github.com/getpelican/pelican#egg=pelican)but I had some troubles:

Downloading/unpacking pytz (from pelican)

Could not find a version that satisfies the requirement pytz (from pelican)
(from versions: 2009r, 2008b, [...] 2012j, 2004b)
Cleaning up...
No distributions matching the version for pytz (from pelican)

From the log: Ignoring link https://pypi.python.org/packages/source/p/pytz/pytz-2012j.zip#md5=fc37f7acd4e32644c5a8b5ac116d2068 (from https://pypi.python.org/simple/pytz/), version 2012j is a pre-release (use --pre to allow).

justinmayer commented 11 years ago

Which theme are you using? Whether something "works" or not is highly dependent on the theme. If you are not using the notmyidea theme, do you get the same problem with images if you use that theme?

Your issue with pytz is not unique — that package has a non-standard version number scheme, so pip (1.4+) thinks it's an alpha or beta and skips installing it. As suggested in the error output, simply install pytz first via the following command, and then continue installing Pelican:

pip install --pre pytz
justinmayer commented 10 years ago

@PhML: If there is anything else we can do to assist you with this issue, please feel free to re-open it. Thanks!