[mezzanine-users] How to fix UnicodeEncodeError

2017-06-30 Thread Karim
Hello, I got a couple of exceptions on production caused by Unicode, but I
have no idea how to fix without edit the blog. Is related to the LANG?
(actually 'it_IT')


Here the traceback:


Internal Server Error: /blog/klaipėdoj-gyvena-mergaitė-vardu-dolce-gabana/

UnicodeEncodeError at /blog/klaipėdoj-gyvena-mergaitė-vardu-dolce-gabana/
'latin-1' codec can't encode character '\u0117' in position 64: ordinal not
in range(256)

Request Method: GET
Request URL:
http://www.example.com/blog/klaip%C4%97doj-gyvena-mergait%C4%97-vardu-dolce-gabana/
Django Version: 1.10.7
Python Executable: /home/user/.venvs/myvenv/bin/python3.6
Python Version: 3.6.1




Traceback:

File
"/home/user/.venvs/myvenv/lib/python3.6/site-packages/django/core/handlers/exception.py"
in inner
  42. response = get_response(request)

File
"/home/user/.venvs/myvenv/lib/python3.6/site-packages/django/core/handlers/base.py"
in _legacy_get_response
  249. response = self._get_response(request)

File
"/home/user/.venvs/myvenv/lib/python3.6/site-packages/django/core/handlers/base.py"
in _get_response
  217. response = self.process_exception_by_middleware(e,
request)

File
"/home/user/.venvs/myvenv/lib/python3.6/site-packages/django/core/handlers/base.py"
in _get_response
  215. response = response.render()

File
"/home/user/.venvs/myvenv/lib/python3.6/site-packages/django/template/response.py"
in render
  109. self.content = self.rendered_content

File
"/home/user/.venvs/myvenv/lib/python3.6/site-packages/django/template/response.py"
in rendered_content
  84. template = self.resolve_template(self.template_name)

File
"/home/user/.venvs/myvenv/lib/python3.6/site-packages/django/template/response.py"
in resolve_template
  66. return select_template(template, using=self.using)

File
"/home/user/.venvs/myvenv/lib/python3.6/site-packages/django/template/loader.py"
in select_template
  48. return engine.get_template(template_name)

File
"/home/user/.venvs/myvenv/lib/python3.6/site-packages/django/template/backends/django.py"
in get_template
  39. return Template(self.engine.get_template(template_name),
self)

File
"/home/user/.venvs/myvenv/lib/python3.6/site-packages/django/template/engine.py"
in get_template
  160. template, origin = self.find_template(template_name)

File
"/home/user/.venvs/myvenv/lib/python3.6/site-packages/django/template/engine.py"
in find_template
  134. name, template_dirs=dirs, skip=skip,

File
"/home/user/.venvs/myvenv/lib/python3.6/site-packages/django/template/loaders/base.py"
in get_template
  38. contents = self.get_contents(origin)

File
"/home/user/.venvs/myvenv/lib/python3.6/site-packages/django/template/loaders/filesystem.py"
in get_contents
  24. with io.open(origin.name,
encoding=self.engine.file_charset) as fp:

Exception Type: UnicodeEncodeError at
/blog/klaipėdoj-gyvena-mergaitė-vardu-dolce-gabana/
Exception Value: 'latin-1' codec can't encode character '\u0117' in
position 64: ordinal not in range(256)
Request information:
USER: AnonymousUser


-- 
Karim N. Gorjux

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [mezzanine-users] Trouble With Deployment

2017-06-18 Thread Karim
On Mon, Jun 19, 2017 at 2:29 AM, KD <walsh...@gmail.com> wrote:

> I'd appreciate any insight into what the problem is.  Thanks for your time.



​Did you try to connect to your server and manually run the sudo command?​



-- 
Karim N. Gorjux

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[mezzanine-users] Re: Can upload the media file, but no thumbnail e no right url in the posts

2017-06-13 Thread Karim
On Tue, Jun 13, 2017 at 5:49 PM, Karim <lemieli...@gmail.com> wrote:

> Any suggestion where to look?


At the moment the problem seems to be a setup problem in webfaction. On the
running app I got an error on import PIL: Importing error cannot import
name '_imaging

​The weird thing is that the import PIL works fine if I run the import in a
django shell (python manage.py shell​)

​I'll check with webfaction's support.

Thank you.​

-- 
Karim N. Gorjux

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[mezzanine-users] Re: Can upload the media file, but no thumbnail e no right url in the posts

2017-06-13 Thread Karim
I narrowed the problem (or I guess so).

Here the settings on production:

In [2]: settings.STATIC_ROOT
Out[2]: '/home/user/webapps/static_app/'

In [3]: settings.STATIC_URL
Out[3]: '/static/'

In [4]: settings.MEDIA_ROOT
Out[4]: '/home/user/webapps/static_app/media/'

In [5]: settings.MEDIA_URL
Out[5]: '/static/media/'

If I upload a file using django-filebrowser the file is loaded and stored
in the STATIC_ROOT, but somehow the thumbnail is not generated and in the
django-filebrowser panel the src of the thumbnail is /static/media/.

If I load the image file in a post, I see the image correctly in the
WYSIWYG editor, the html generated in there point correctly to the image
url. The problem is the published post where the image is broken because
the src is, like in the filebrowser panel, /static/media/

The error is in the url process of the static file, but I don't know where
to look.

I already checked:

- The permissions on the server are ok.
- The Pillow installation works.
- The images in static/ are available and I can load them from the browser.


Any suggestion where to look?





-- 
Karim N. Gorjux

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [mezzanine-users] Re: python 3.5 / mod_wsgi / apache 2.4 / SOME static files are not found, others are

2017-06-12 Thread Karim
On Mon, Jun 12, 2017 at 7:25 PM, Melvyn Sopacua <m.r.sopa...@gmail.com>
wrote:

>
>
> Use os.path.realpath() in your settings file. The drawback being that
> changing the target of the symlink requires a reload of Django/WSGI for it
> to be picked up. This is not by definition a bad thing.
>
>
>
> A similar approach is to implement your own storage engine and call
> os.path.realpath on STATIC_ROOT. Of course, this opens you up to symlink
> attacks.
>

​I'm in a shared hosting (webfaction) so my hands are tied and I can't do
what I want.

Fixed the MEDIA_ROOT and STATIC_ROOT. Also the urls are ok

In [4]: from django.conf import settings
In [5]: settings.STATIC_URL
Out[5]: '/static/'

In [6]: settings.STATIC_ROOT
Out[6]: '/home/
​myuser
/webapps/kng_static/'

In [7]: settings.MEDIA_URL
Out[7]: '/static/media/'

In [8]: settings.MEDIA_ROOT
Out[8]: '/home/
​myuser​
/webapps/kng_static/media/'


​If I try the mezzanine_tags:​

In [3]: from mezzanine.core.templatetags.mezzanine_tags import thumbnail
   ...: img = '/home/
​myuser
/webapps/kng_static/media/upload/
​test_image
.jpg'
   ...: thumbnail(img, 80, 80)
   ...:
Out[3]: '/home/systemx/
​myuser
/kng_static/media/upload/.thumbnails/
test_image
.jpg
​/​
test_image
-80x80.jpg'

​The problem is still the same in the filebrowser. No thumbnail because the
src of the img pointed is `www.mywebsite.com/static/media/`and if I use the
filebrowser on a post, the image rendered use the src `
www.mywebsite.com/static/media/`

​The permissions are ok and I can see the images if I point to the specific
url in the browser.

I think I must implement the logging and fight my laziness...​

​Thank you for your support Melvyn​


-- 
Karim N. Gorjux

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [mezzanine-users] Re: python 3.5 / mod_wsgi / apache 2.4 / SOME static files are not found, others are

2017-06-12 Thread Karim
On Sun, Jun 11, 2017 at 10:43 PM, Melvyn Sopacua <m.r.sopa...@gmail.com>
wrote:

>
>
> On Sunday 11 June 2017 08:26:44 Karim wrote:
>
> > UPDATE
>
> >
>
> > if STATIC_URL and MEDIA_URL are set with the `http://` the img are
>
> > correctly rendered in the posts with the right `src`.
>
> >
>
> > The thumbnails generation in django-filebrowser is still broken
>
> > because point to `static/media`
>
>
>
> If STATIC_URL fixes part of your problem, then your setting is incorrect.
> Make sure they are absolute, not relative, so /static/ not static/.
>
>
>
> If no thumbnails are generated on disk, then (like Joshua) the problem is
> with Pillow.
>
>
>
> You can test what happens in a django shell as follows:
>
> >>> from mezzanine.core.templatetags.mezzanine_tags import thumbnail
>
> >>> thumbnail('/media/uploads/foo.jpg', 80, 80)
>
>
>
> (needs to be an existing image bigger then 80x80 for any Pillow runtime
> related errors to surface.)
>

​Thanks, I think you pointed me to the right way to solve this.

SuspiciousFileOperation: The joined path
(.../kng_static/media/uploads/qa_fields.png) is located outside of the base
path component (.../kng/kng_site/static/media)​

​This happens because the `static` dir in my project is a link to another
dir.​

​Thanks​


-- 
Karim N. Gorjux

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [mezzanine-users] Re: python 3.5 / mod_wsgi / apache 2.4 / SOME static files are not found, others are

2017-06-10 Thread Karim
UPDATE

if STATIC_URL and MEDIA_URL are set with the `http://` the img are
correctly rendered in the posts with the right `src`.

The thumbnails generation in django-filebrowser is still broken because
point to `static/media`


-- 
Karim N. Gorjux

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [mezzanine-users] Re: python 3.5 / mod_wsgi / apache 2.4 / SOME static files are not found, others are

2017-06-10 Thread Karim
On Sun, Jun 11, 2017 at 3:04 AM, <joskra42.l...@gmail.com> wrote:

> One update.  I was able to get rid of the error related to Indexes, but
> the graphic URLs are still not being formed properly (and therefore, no
> graphics are shown).


​I have the same error as I described on my mail here in the list: "Can
upload the media file, but no thumbnail e no right url in the posts".

I use python 3.6.1 on apache and the static files are managed by a
different nginx instance.

​The problem is the same. On django-filebrowser I don't get the thumbnails,
but Pillow is correctly installed. I notice a 403 error after the upload
when pointing `static/media`.

On the published post the src is not formed correctly but just point to the
media folder even if on the rich text editor the image was correctly
handled and pointed to the correct url and rendered.

How you solved this?

One update.  I was able to get rid of the error related to Indexes


​What I did so far:
​
- Checked and changed the file permissions on the server.
​- Reinstalled Pillow
​- Checked the MEDIA* and STATIC* settings on production

At the moment still now working and I have no idea what to do to fix this.

​Cheers​

-- 
Karim N. Gorjux

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[mezzanine-users] Can upload the media file, but no thumbnail e no right url in the posts

2017-06-08 Thread Karim
Hello list, I have a problem with the media, but I can't understand where
to look to fix the problem.

If I upload a file through the filebrowser, is correctly uploaded in the
"static/media/uploads".

The first problem is the thumbnail that is not generated and I got the
missing image icon in the list of the media.

​In a post or a page, I can select the uploaded image and I see the image
the rich text editor. The url is correct "/static/media/uploads/foo.jpeg".

The second problem is in the published post (or page) even if the image was
correctly previewed in the rich text editor, in the published post I get
the image load error icon and the img src​ is just "/static/media/"

Any clue where is the problem?

Thank you

-- 
Karim N. Gorjux

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [mezzanine-users] Re: Wordpress import and redirects

2017-05-29 Thread Karim
On Mon, May 29, 2017 at 12:40 PM, Stephen McDonald <st...@jupo.org> wrote:

> Not sure about the second issue, but if you can create a PR with your fix
> for the first issue, that would be great thanks.


​The second issue is not an issue was my misunderstanding. I finally
deployed my blog with Mezzanine and everything works.

About the PR, I'll do that ASAP

Thank you Stephen :-)​



-- 
Karim N. Gorjux

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [mezzanine-users] Re: Wordpress import and redirects

2017-05-28 Thread Karim
Hello, I found some time to work on this and I changed the
import_wordpress.py (line 75)

if entry.wp_post_type == "post":
​​
post = self.add_post(title=entry.title, content=content,
​​
pub_date=pub_date, tags=terms["tag"],
​​
categories=terms["category"],
*​​old_url=entry['link'])*


​Instead of* old_url=entry.id <http://entry.id>* I used
*old_url=entry['link']*

The result: I got ALL the redirects.​

Another issue (or maybe not) is the redirects with accents. I have some
redirects like:

*old_url = /2010/05/03/la-stagione-della-luce-e-arrivata-finalmente/*
*new_url = /blog/la-stagione-della-luce-%C3%A8-arrivata-finalmente/*


This works because the new url is handled by mezzanine. The new_url slug is
generated from the title (?).

In this case:

*old_url =
 
/2010/03/09/e%e2%80%99-possibile-dare-una-spintarella-a-questo-inverno-e-mandarlo-gentilmente-in-vacanza-nell%e2%80%99emisfero-australe/*
*new_url
= 
/blog/e-possibile-dare-una-spintarella-a-questo-inverno-e-mandarlo-gentilmente-in-vacanza-nellemisfero-australe/*


But actually in wordpress the original old_url is:
*/2010/03/09/e’-possibile-dare-una-spintarella-a-questo-inverno-e-mandarlo-gentilmente-in-vacanza-nell’emisfero-australe/*

​If in my local I use the old_url as in the Redirect object, the url is
changed to: *http://127.0.0.1:8000/2010/03/09/e
<http://127.0.0.1:8000/2010/03/09/e>’-possibile-dare-una-spintarella-a-questo-inverno-e-mandarlo-gentilmente-in-vacanza-nell’emisfero-australe/*
(as in wordpress), but I get a 404.​

​I have the feeling that this is a bug.​

​Any thoughts?​



-- 
Karim N. Gorjux

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [mezzanine-users] Re: Wordpress import and redirects

2017-05-21 Thread Karim
On Sun, May 21, 2017 at 11:38 PM, Ken Bolton <kenbol...@gmail.com> wrote:

> Database looks good.
>
> Can you try an experiment for me? Try making a new mezzanine site exactly
> as you
> ​[...]
>

​Done. Everything seems fine. No strange characters and if I add accents
chars to the database, everything is rendered correctly.

I think is something related to the import_wordpress

​Cheers



-- 
Karim N. Gorjux

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [mezzanine-users] Re: Wordpress import and redirects

2017-05-21 Thread Karim
On Sun, May 21, 2017 at 11:03 PM, Ken Bolton <kenbol...@gmail.com> wrote:

> Hi Karim,
>
> Not at all certain, but it sounds like you may have a problem with
> character encoding in the database,
>

​Postgresql:

# SHOW SERVER_ENCODING;

 server_encoding

-

 UTF8

(1 row)




> the operating system, or both.
>

​I use a mac and python3. No problem with other projects. It's not a
confirm but I don't know how to test if my encoding it's ok.​


​Thank you.​

-- 
Karim N. Gorjux

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[mezzanine-users] Re: Wordpress import and redirects

2017-05-21 Thread Karim Gorjux
I did some investigation and I wrote a script to import the missing 
redirects. Maybe, but I'm not sure, it's something related with the accents 
in the (entry.id).
Checking the import_wordpress code the `entry.id` is passed to the 
`add_post` in the BaseImporter, but the `entry.id` sometimes doesn't 
contains the slug. I found more reliable
the entry['link'] to get the permalink of the wordpress article.

If it's just an isolate problem, I'm happy now to have my importer. But if 
you think it's a bug, maybe I can investigate more.

Thank you

-- 
Karim N. Gorjux



-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[mezzanine-users] Wordpress import and redirects

2017-05-20 Thread Karim
Hello coders, I almost finished the migration from Wordpress to Mezzanine.
I used the wordpress import to populate the database; I was testing the
urls and I notice this:

In [1]: from django.contrib.redirects.models import Redirect
In [2]: Redirect.objects.all().count()
Out[2]: 304

In [3]: from mezzanine.blog.models import BlogPost
In [4]: BlogPost.objects.all().count()
Out[4]: 674


​I have 674 articles, but less than the half have a redirects and I can't
deploy until I get all in the redirects.

The questions:

1) Did I find bug in the wordpress import?
2) Do I have to write a script to parse the wordpress xml to check every
post or this is a known issue and you have already a trick to solve it?

​Thanks
​

-- 
Karim N. Gorjux

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[mezzanine-users] Import from wordpress without comments

2015-09-22 Thread Karim
Hello everyone, I installed mezzanine and I'm trying to import my blog with
700 posts and 3000 comments.

The comments are not necessary to import in my case because I migrated all
on disqus, but actually a copy synced to the disqus server is on wordpress'
db.

I was thinking to add an option --no--comments to skip the import of the
comments on the import_wordpress command.

The question is: how I use the disqus service on the imported blog on
mezzanine?

thanks.


-- 
Karim N. Gorjux

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.