SSL Enable

sudo certbot --apache -d tech-overflow.com -d www.tech-overflow.com

sudo certbot --apache -d tech-question.com -d www.tech-question.com

sudo certbot --apache -d python-ds.com -d www.python-ds.com

sudo certbot --apache -d python-ds.com -d www.python-ds.com

cat /etc/apache2/apache2.conf

https://www.digitalocean.com/community/tutorials/apache-configuration-error-ah00558-could-not-reliably-determine-the-server-s-fully-qualified-domain-name

https://www.ssllabs.com/ssltest/analyze.html?d=python%2dds.com&latest

https://www.ssllabs.com/ssltest/analyze.html?d=www.python-ds.com

View More...

What is Tell() and seek() functions ??

tell() function is using for telling the file pointer location but seek() is used for reset the file pointer.

Example-

f= open("fileName.txt")

print(f.tell()) #output 0

print(f.readline()) #output Reading 1 line.(This is good Idea)

print(f.tell()) #18

print(f.readline())

# Seek() Function

f= open("Nishu.txt")

print(f.readline())

print(f.seek(0))

print(f.readline())

print(f.seek(11))

print(f.readline())

View More...

What is DocString???

Docstring is a convenient way to identify that what is executing in a function. It is a type of comment which we can write within a function.That comment write within """ ("""example""").The syntax of Docsting is .__doc__ .

Example-

def function1(a,b):

"""This is a function used for calculating the average of two numbers."""

average= (a+b)/2

#print(average)

function1(5, 6)

print(function1.__doc__)

#Output

This is a function which is calculating the average of two numbers.

View More...

Get API in Django for Separate Category, Subcategory and Sub Subcategory

@api_view(['GET'])

def rowCategory():

category = []

sub_category = []

sub_sub_category = []

row_sql = ''' select t.*, (case when t1.parent_id is not null then 'sub_sub_category' when t1.category_id is not null then 'sub_category' else 'category' end) as level from master_category t left outer join master_category t1 on t.parent_id = t1.category_id order by coalesce(t1.parent_id, t1.category_id, t.category_id), coalesce(t1.category_id, t.category_id), t.category_id'''

for c in Category.objects.raw(row_sql):

if c.level == 'category':

category.append({"category_id": c.category_id, "status": c.status, "name": c.name, "slug": c.slug,

"parent_id": c.parent_id, "level": c.level})

elif c.level == 'sub_category':

sub_category.append({"category_id": c.category_id, "status": c.status, "name": c.name, "slug": c.slug,

"parent_id": c.parent_id, "level": c.level})

else:

sub_sub_category.append({"category_id": c.category_id, "status": c.status, "name": c.name, "slug": c.slug,

"parent_id": c.parent_id, "level": c.level})

return {"category": category, "sub_category": sub_category, "sub_sub_category": sub_sub_category}

View More...

First Previous 7 8 9 10 11 Next Last