Hey Sergei, glad that you are getting it sorted! For images, I think that you could put the images under the media directory, and then just update your IMG_ROOT setting. I.E. put all the images in /static/media/uploads/img/ (so they show in the media library) and then update your IMG_ROOT to point there (so they work the way you set it up). Then update that URL you set up, or even configure apahce/nginx/whatever to serve /res/img/ from the directory in /static/media/uploads. In general it's better (definitely performance wise, maybe security too) to have your front webserver server static files, rather than have Django do it.
On Wed, Jan 1, 2014 at 10:06 PM, Sergei G <[email protected]> wrote: > Its my 1st django project... > > I have some answers to my own questions. > > *Preserving Existing Image Urls* > > Image file import. I decided to import old images into /static/img/ > directory. > I then had to add URL mapping: > > in settings.py: > > IMG_URL = '/res/img/' > IMG_ROOT = os.path.join(PROJECT_ROOT, *"static/img".split("/")) > > in urls.py: > > urlpatterns += patterns( > .... > ) + static(settings.IMG_URL, document_root=settings.IMG_ROOT) > > That had the intended effect. > > Unfortunately, my images are not picked up by media browser. It seems only > work with content of > /static/media/uploaded/ > directory. Is there a way to include my IMG_ROOT directory? > > *Markdown* > > I decided to apply markdown conversion to content prior during import. > > *Redirects* > > I observed that for redirect to work the old_url must end with slash. > After that redirect works. It even works if I don't type ending slash in my > browser. > > > On Wednesday, January 1, 2014 1:26:48 AM UTC-8, Sergei G wrote: >> >> Thanks, it helped. >> >> I have succeeded in creating my own import py file and I loaded articles >> into blog posts. >> >> To the next level of detail: >> >> 1. Is there an example of how to import image files? I will need to make >> sure that my images continue using /res/img/ URL prefix. >> >> 2. I had a very nice SQL for crossing tags assigned to articles and thus >> bubbling up the most relevant articles automatically. I see that I can >> assign relevant articles manually, but the solution is not self-maintaining >> as older articles will not be updated with new relevant data. Do you think >> this kind of dynamic resolution of related items is possible with Mezzanine? >> >> 3. I observed that when I import publish_date setting it to None sets it >> to current date. I think I observed that Drafts created manually have >> publish_date set to NULL in DB. >> I had to go around create post convenience method as it does not expose >> other parameters that I have information about, such as Draft status, >> create date, last update date: >> >> self.posts.append({ >> "title": force_text(post['title']), >> "publish_date": published, >> "status": status, >> "content": force_text(post['content']), >> "categories": [], >> "tags": [], >> "comments": [], >> "old_url": post['path'], >> }) >> >> 4. I hope to use mezzanine tools to convert markdown to HTML instead of >> using library I used to use. is the a function that I can use instead of >> force_text that uses markdown to mezzanine format? >> >> 5. Categories. Are categories just a free form text? What's the >> difference from tags since it appears I can assign more than one category? >> >> 6. Tags. Are tags a free form text? Can tags have spaces? >> >> 7. Redirects. I saw nice messages during import "Created redirect for: >> /old/path/to/article". However when I went to http://127.0.0.1:8000/old/ >> path/to/article I got error 404 - Page not found. I observed that my >> path ends without slash, but after page is displayed slash is appended to >> URL path. There is no .HTML extension at the end of the url in my case. >> >> >> Thanks >> >> On Tuesday, December 31, 2013 4:21:00 AM UTC-8, Arnold Krille wrote: >>> >>> Hi, >>> >>> Am Mon, 30 Dec 2013 16:08:19 -0800 (PST) >>> schrieb Sergei G <[email protected]>: >>> > I have a private blog posting + digital product publishing system and >>> > I would like to migrate its content into mezzanine. >>> > Do you guys have some advice on what direction I should take. I am >>> > the author of this private system and I am not afraid of writing >>> > Python code. I just need some solid pointers on what is the >>> > appropriate way to import data into Mezzanine system. >>> >>> There are some examples for importing content from >>> blogger/wordpress/rss in mezzanine. Probably the best would be to start >>> your own mezzanine/django-app and create an importer there based on >>> what you learn from looking at mezzanine's importers. >>> >>> > Is there any support for product sales in Mezzanine? My schema in >>> > product sales is quite unique to digital product sales, so I am not >>> > sure how much reuse I can get from Mezzanine. >>> >>> There is Cartridge. >>> >>> You should start by setting up mezzanine (+cartridge) as you think you >>> want it to behave. Then ditch everything and redo with the knowledge >>> you gained the first time. Then start an app to implement your theme, >>> then start an app to write the importer (see above). Then you will know >>> what you are doing. >>> >>> Have fun, >>> >>> Arnold >>> >> -- > 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 [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > -- 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 [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
