To change all the directory permission in the path /var/www/html/ use the below command
 find /var/www/html/ -type d -exec chmod 755 {} \;
and for files
 find /var/www/html/ -type f -exec chmod 644 {} \;

 


In the linux machine go to the folder /tmp/magento/var/cache
then type the command $ rm -rf *

Then press Ctrl+F5 in the browser

 

Csv upload and import in python django

Posted In: , . By CreativeSolutions


 if request.method == 'POST':
        srcfile = request.FILES.get("file", None)
        reader = csv.DictReader(srcfile) # read rows into a dictionary format
        for row in reader:
   print row

 

How to show django cursor execute query

Posted In: . By CreativeSolutions


 We can use the variable _executed with the cursor object ie. cursor._executed

 cursor = connection.cursor()
 cursor.execute(sql, (params))
 print cursor._executed
 rows = cursor.fetchall()

 

Using for loop counter in django template

Posted In: . By CreativeSolutions


 Django has the function forloop.counter to use the index for the row in template

 Ex:
 {% for question in questions %}
{{ forloop.counter }}
  {% endfor %}