Opencart Gzip doesnt work - compression

I couldnt find the solution everything is ok on the server and htacess file.
But on my xxxxx.com doest work gzip.But xxxxx.com/admin gzip working.
I need to activate to gzip to my homepage because website loading time is about 9sec.
Anyone can help me thank you.

You tried to set the compression level in admin settings
http://xxxxxx.com/admin/index.php?route=setting/setting ?
Put there a value from 0 to 9 (for example 6).

Related

content empty when using scrapy

Thanks for everyone in advance.
I encountered a problem when using Scrapy on Python 2.7.
The webpage I tried to crawl is a discussion board for Chinese stock market.
When I tried to get the first number "42177" just under the banner of this page (the number you see on that webpage may not be the number you see in the picture shown here, because it represents the number of times this article has been read and is updated realtime...), I always get an empty content. I am aware that this might be the dynamic content issue, but yet don't have a clue how to crawl it properly.
The code I used is:
item["read"] = info.xpath("div[#id='zwmbti']/div[#id='zwmbtilr']/span[#class='tc1']/text()").extract()
I think the xpath is set correctly and I have checked the return value of this response and it indeed told me that there is nothing under this directory. Results shown here:'read': [u'<div id="zwmbtilr"></div>']
If it has something, there should be something between <div id="zwmbtilr"> and </div>.
Really appreciated if you guys share any thoughts on this!
I just opened your link in Firefox with NoScript enabled. There nothing inside the <div #id='zwmbtilr'></div>. If I enable the javascripts, I can see the content you want. So, as you already new, it is a dynamic content issue.
Your first option is try to identify the request generated by javascript. If you can do that, you can send the same request from scrapy. If you can't do it, the next option is usually to use some package with javascript/browser emulation or someting like that. Something like ScrapyJS or Scrapy + Selenium.

URL redirect plugin regex input for match and target

I'm panicking a little, so sorry if I haven't explained well enough.
I've dealt with quite the nightmare of a permalink restructuring experience
Old permalink= sitename/archives/postid
desired new= sitename/postname
tried everything it seems. I've even dabbled with /?p=$1 (<-----that nonsense!). But now i'm getting some crazy error when i go to my old permalink structure that reads:
Oops! Google Chrome could not connect to 0.0.37.89
Suggestions:
Try reloading: 0.­0.­37.­89
and this was supposed to be "redirected".
I give up. please help.
sitename= brightontheday.com
I used the redirection plugin to redirect all old URL permalinks (/archives/postID) to the new permalink (/postID/postname)
also, the issue appeared to be due to cashing via cloudfare. It's important to to note that one should put cloudfare in "developer mode" while making site wide changes.

Force download - Python

I would like to ask you, how to do force download of file from browser in Python. I have lot of pdf files, that I force downloading with PHP, to prevent opening them in browser
<?php
if (isset($_GET['download'])) {
$link = $_GET['download'];
header('Content-disposition: attachment; filename='.$link.'');
header('Content-type: application/pdf');
readfile($link);
}
?>
I have tried like half of the internet, I used urllib, urllib2, headers,.. I believe its a simple thing that I missed, because I just learn python and I want to rewrite my site into Python to learn it. I am able to create copy of pdf files, rename them, whatever. But it always remains on the server. It doesnt start download.
Any ideas please?
Thank you, have a great day..
Check this link - http://css-tricks.com/snippets/htaccess/force-files-to-download-not-open-in-browser/
Add Lines to your apache conf (or htaccess)
AddType application/octet-stream .pdf
Worked perfectly for me.
[EDIT]
Check the link - Serve up pdf as a download with Pyramid, ningx, X-Accel-Redirect Header
Point to be noted -
Content-Disposition: attachment
Try an tell me if this worked.
Further Links on the Topic -
Content disposition
How to download a file using python in a 'smarter' way?

Cherokee redirect

My server is running Cherokee and I'm trying to get a redirect to work. I'm running into troubles with infinite redirect loops because I am redirecting to the same folder.
My URL is:
http://domain.tld/example-variable (http://domain.tld/product-1234)
This needs to be redirected to:
http://domain.tld/index.php?item=variable (http://domain.tld/index.php?item-1234)
The Regex I have tried is:
^/product-(.*)
/index.php?item-$1
This redirect is working. However, http://domain.tld is now broken as well as files like images (http://domain.tld/image.jpg). Other redirects I'm using are working just fine, but they redirect a folder to another folder (i.e. /folderA to /folderB).
have you tried making the rule non-final and the ordering is correct? typically, those two will cause the sort of issue you're seeing.
#brent I've tried that indeed and all combinations I could think of where not solving the problem.
I ended up using a subdomain:
product.domain.tld/1234

Django admin file upload doesn't work, how do I debug this?

I'm on Mac Leopard. Trying to get django admin file uploads, or really image uploads to work. In my app's models.py I set the field to:
image = models.FileField(upload_to='images', max_length=500)
(started w/ ImageField, but thought if a file doesn't work, then the image for sure won't work)
It says the upload happened. Gives me a positive result. Saves the path to my database. But looking for the file, well, it isn't there.
Since there's no error message, it's hard to debug.
Tried various permissions, but nothing is working.
Any ideas?
Is your MEDIA_ROOT set correctly? http://docs.djangoproject.com/en/dev/ref/models/fields/#filefield
From the comments it sounds like you found a solution to your issue. For future reference, you may want to check out django-debug-toolbar to help you troubleshoot problems like this (Especially when there's no error, it just doesn't work right!). Code available here: http://github.com/robhudson/django-debug-toolbar/tree/master