If you really want me to make a social networking website in Django in one video, share this Django series everywhere! I will definitely make a video explaining social networking website development in one video if I get 500+ shares on my playlist! Thanks a lot in advance to all those who shared! Link is here - th-cam.com/play/PLu0W_9lII9ah7DDtYtflgwMwpT3xmjXY9.html
sir jab mera ko command 'python manage.py runserver' run karunga tab , Exception in thread django-main-thread: aah raha hei kya karu server start nahi hoo raha
Tried Udemy, Lynda and everything and was facing difficulty in even understanding simple things. By luck i came here and I am stuck here. So amazing quality content. You ARE UNDERRATED
I do your quiz by creating a text file and make a function name test in views file and then use file handling and do like def test(request): f1 = open("first.txt", "r") return HttpResponse(" %s " % (f1.read()))
Yar mera ek masla h solve kro ge to bari meherbani hogi aap ki 😄 Sb kuch sahi h lekin file1.txt not found error araha ha wo txt file bhi wahin pr ha jahan views.py and urls.py ha
@@salmanali-bf4nk first of all always specify filemode ----> with open("path_to_file",'r') as f: ------- and keep rest of the code same :) and make sure your file shares the same directory as that of manage.py
def index(request): with open("1.txt", "r") as f: # Opening the file in read mode, we don't use r+ because file already exists, r+ is used when file doesn't exists then assigning it a variable named f content = f.read() # Reading the contents of the file and storing it in a variable, we use read instead of readlines because readlines gives each line as a list element return HttpResponse(content)
added below in Index function and worked like charm def index(request): f = open(r'C:\Users\kumarsan\PycharmProjects\DjangoCourse\TestUtils\textutils\textutils\Homepage.txt', 'r') data = f.read() return HttpResponse(data)
def index(request): f=open("D:\\Django MA\\textutils\\textutils\\textutils\\info.txt") c = f.read() return HttpResponse(c) Harry bhai work done successfully.
i used this method def file_content(request): file = "C:\\Najam\\Web developement course\\Django Course\\one.txt" with open(file, 'r', encoding='utf-8') as f: read = f.readlines() return HttpResponse(read)
cannot find any directory plz guide brother by the way I have tried too many web sites and channels to learn django but here I found it...love your cotent
When I did the whole process following you but I didn't get textutils two times in terminal and you cut that part in the video please tell me how you did it?
If you are in first text utils then simply type ' cd textutils ' in the terminal. This will take you to the required directory. Now you can type ' python manage.py runserver ' to start the server. I hope this helps. If not then you're welcome.
Harry bhai it's not working for me?? I import from . import views Add path path(' '), views.index, name='index') And whatever you do in views. Py file,same I do in views. Py file but it's not gives any output in server
i got error when ever i add another section like harry add about then I got error like can't reach file 127.0.0 refused to connect. please help me harry sir.
sol: def index(request): try: f = open('name.txt', 'w') f.write('Hello World, how are you?') except Exception as e: print(e) try: f = open('name.txt', 'r') return HttpResponse(f.read()) except Exception as e: print(e)
i'm having one issue. i'm running the same steps as shown in the video but hello is not printing. it is always showing the django admin page. what can I do?
The same people occurred to me, after saving your work, try resorting your computer and opening Pycharm again, when the same prob occurs to me i gave up & then after a few days, I opened my project, reloaded (by saving), it worked for me
Sir I have a problem occurs in our file is C:/New folder/37/python.exe: can't open file 'C://Users//abc//textutilise//manage.py': [Error 2] No such file or directory
Hi, i am facing a problem while running server. when i save the code then i click on refresh but code is not working. only it shows first screen of congrats! message. plz help to fix it.
I have done the exercise by making a simple function using with open block and read the text file and save it in a variable and return it as a http response
*Sir me jab **manage.py** ka server run karta hun to wo run ho jata hai.. uske bad agar mene code me koi glti kardi to or browser pe reload kiya to "error loading page" ata hai or phir server chalta he nahi hai.. cmd ko restart kar k server chalana prta hai. Or sir na about ka page open ho raha hai or na home page pe code change karny se changing aarahi*
I was able to complete your assignment using Path from pathlib and read the txt file stored in the same folder and manage,py and then passing the string into the return HTTPResponse function
My code is running fine and i am also getting the correct output in the browser but my terminal shows 7-8 errors after closing/minimizing the browser. Is it only me or others are getting the same errors too??
How to get inside your current file using the terminal? I am not able to go to manage.py because I am not able to get into the right file, can anyone help me, please?
from django.http import HttpResponse def display_file(): with open('abc.txt') as f: for i in f: return (i) def index(request): return HttpResponse(display_file()) def about(request): return HttpResponse("about myself abc")
def file(requet): with open('one.txt','w') as f: f.write("This is file content") with open("one.txt") as f: return HttpResponse(f.read()) path('', vfir.file, name='file')
Sorry for delay thoda bahar chala gya tha. The approach will be to open the file first using open() method then read the contents of the file and save to a variable like content = f.read() then simply pass this content variable into the HttpResponse() method to display the actual content of the file. I tried with HTML code and it worked unexpectedly really well.
If you really want me to make a social networking website in Django in one video, share this Django series everywhere!
I will definitely make a video explaining social networking website development in one video if I get 500+ shares on my playlist!
Thanks a lot in advance to all those who shared!
Link is here - th-cam.com/play/PLu0W_9lII9ah7DDtYtflgwMwpT3xmjXY9.html
I will love to see how to make social netwoking web side
after writing python manage.py runserver
at last syntax error is showing
sir jab mera ko command 'python manage.py runserver' run karunga tab , Exception in thread django-main-thread: aah raha hei kya karu server start nahi hoo raha
How u can add apps in settings.py file of main project????
@@memoriesmaker9886 you might have forgotten to put a , after path
Tried Udemy, Lynda and everything and was facing difficulty in even understanding simple things. By luck i came here and I am stuck here. So amazing quality content. You ARE UNDERRATED
same here..truly amazing..
I totally agree with you, I even bought a course on udemy
that is .... that didn't teach you much, I hated that course
I still do
yea
actually udemy is useless i learned a lotof things here..he need a aplause
Def funtext(request):
file = open('pathofthetext', 'r')
Content = file.read()
file.close()
return httpresponse(content, content_type = 'text/plain')
def hota hai
def index(request):
file = open("1.txt",'r+')
return HttpResponse(file.read()),
This is a piece of code for the assignment task.
bro r+ matlb?
@@filmystaanchannel4501 read and write both
@@TariqAhmed_ thnx bro
@@TariqAhmed_ par mene jab r+ nhi likha tab bhi chal rha hai code.
@@filmystaanchannel4501 han by default r hota hai.
def index(request):
with open('textutils/file.txt', 'r') as rm:
return HttpResponse(rm.read())
I do your quiz by creating a text file and make a function name test in views file and then use file handling and do like
def test(request):
f1 = open("first.txt", "r")
return HttpResponse(" %s " % (f1.read()))
Thanks sir!🙏
By the way sir, can u plz explain what is the purpose of % sign here? Hope u'll help me. Thanks once again.
@@hardcode5394 docs.python.org/2/library/stdtypes.html#string-formatting-operations
It is a way of string formatting.. OPen the abouve link and you'll definitely understand from example..
Respected Mr. @@madhavaneja6573, thanks a lot for ur help.🙏
Yar mera ek masla h solve kro ge to bari meherbani hogi aap ki 😄
Sb kuch sahi h lekin file1.txt not found error araha ha wo txt file bhi wahin pr ha jahan views.py and urls.py ha
9:45
def index(request):
with open('../1.txt') as file:
data = file.read()
return HttpResponse(data)
can you explain me what is he trying to ask exactly?
from django.http import HttpResponse
def index(request):
with open("filepath/one.txt") as f:
a = f.read()
return HttpResponse(a)
Import error is coming
in my case no error is showing ....but still not displaying content in the server.
@@salmanali-bf4nk first of all always specify filemode ----> with open("path_to_file",'r') as f: ------- and keep rest of the code same :) and make sure your file shares the same directory as that of manage.py
apke videoes and explaning ka tarika bhut hi majedar h ..keep on harry sir.
def index(request):
with open("1.txt", "r") as f: # Opening the file in read mode, we don't use r+ because file already exists, r+ is used when file doesn't exists then assigning it a variable named f
content = f.read() # Reading the contents of the file and storing it in a variable, we use read instead of readlines because readlines gives each line as a list element
return HttpResponse(content)
This code where exactly we have to write ?
do we need to make file as 1.txt ?
@@ektapatil5574 yep, "r" mode reads an already existing file. So have "1.txt" in the directory with some content in it.
Wow 👍 I'm very excited for next video. because every day i learn something new. Good job Harry bhai :)
Bhai well Done bhai kyaa Explain karte hoo bhaiiii puraaa......no questions remaining to do google after watching your Videos
Achha fir btao k dusre textiles tk kese pahuche
PycharmProjects\textutils>cd textutils
than you enter to textutils....... thanks haarry bro
love you
i was stuck with view and url you explained it perfectly
thankyou
thank you so much harry, tumhari excitement aur passion k bayehse ye sikhne mein aur bhi majha ata hai
added below in Index function and worked like charm
def index(request):
f = open(r'C:\Users\kumarsan\PycharmProjects\DjangoCourse\TestUtils\textutils\textutils\Homepage.txt', 'r')
data = f.read()
return HttpResponse(data)
def goal(request):
fp = open("sahilsite/one.txt","r")
f = fp.read()
fp.close()
return HttpResponse(f)
Thanks dude.. That's what I needed
def index(request):
f=open("D:\\Django MA\\textutils\\textutils\\textutils\\info.txt")
c = f.read()
return HttpResponse(c)
Harry bhai work done successfully.
def index(request):
with open("1.txt","r") as f:
return HttpResponse(f)
Assignment done harry bhai
Harry Vai, this helps me a lot. I solved this problem by watching this video.
bhai textutills k andar textutills file ko open karne k liye kya command hogi .becasuse jab m manage.py runserver kar rha hu to error aa rhah
You are best Teacher Harry Bhai
Bhai ... Seriously..you have awsm.. teaching skills..
samaj aa raha hai dhere dhere, Thanks Harray Bhaii
def index(request):
f = open("locoStart/1.TXT")
return HttpResponse(f.read())
f.close()
harry bhai big fan
Thank you Harry Bhai - very simple and easy videos!
I did Harry Bro yours last query...iwill...iam excited to doing this query...🙏
Bhai OP sikhata he tu ♥️♥️♥️....
Harry Bhai successfully run ho Gaya , thank uh so much!
from django.shortcuts import render , HttpResponse
def temp(request):
return render(request, file.txt)
it may works !
from django.http import HttpResponse
def rf(response):
with open("filepath/one.txt") as f:
f1 = f.read()
return HttpResponse(f1)
You are amazing at explaining
hoooooooooo gaya
learnt is first time without errors
thanks bro
The way of explaination is from completely beginners to extremely advanced
Thanks a lot Harry bhaii😎
Very Nicely Explain Harte ho!
Hands off!
bhaai dil se shukriya ❣️
i used this method
def file_content(request):
file = "C:\\Najam\\Web developement course\\Django Course\\one.txt"
with open(file, 'r', encoding='utf-8') as f:
read = f.readlines()
return HttpResponse(read)
Harry bhai aap textutils ke andar dusri text utils par kaise aaye
han bhai samaj nhi aya muje b
Bro type { cd .\textutils\ } then enter
First I created one.txt where manage.py located
Then in views.py
def file(request):
with open('one.txt') as f:
return HttpResponse(f.read())
yes i also have to do the same giving file not found error in internal path
File can be opened with " with statement" is the best way.. Good choice buddy
tysm bro....it really helps me..
I am not getting it .Can u please xplain clearly
one of the besxt series
views.py =
def index():
file = open('one.txt')
fh = file.read()
return HttpResponse(fh)
my inspiration sir love you
cannot find any directory
plz guide brother
by the way I have tried too many web sites and channels to learn django but here I found it...love your cotent
you always needs thumbs UP dude
We can read the txt file as text and store it as a string and we can use return HttpResponce with that string in our views.index function
Bruh
Mere pycharm me Ctrl + S press krne pr new development server generate nhi hora plz bataeya ke kese karu .
Mee Kae bar try kr Chuka
@@shubham6523 ctrl+s urls wale file me karne ke baad reload karo....agar ab bhi nahi hora to extensions install karo
I Love you Harry...❤❤❤
Thanks...... Best youtuber
Superb, simply wonderful... hats off to you, boy. keep it up.
You ARE UNDERRATED
harry bhai django tutorial very good
You teach so well bro....god bless you
thank you so much harry. I loved every course of yours.
Harry sir you are the best🙏
When I did the whole process following you but I didn't get textutils two times in terminal and you cut that part in the video please tell me how you did it?
If you are in first text utils then simply type ' cd textutils ' in the terminal. This will take you to the required directory. Now you can type ' python manage.py runserver ' to start the server. I hope this helps. If not then you're welcome.
Thanks
@@tusharkadam7471 thanks alot bro
Harry bhai it's not working for me??
I import
from . import views
Add path
path(' '), views.index, name='index')
And whatever you do in views. Py file,same I do in views. Py file but it's not gives any output in server
hey bro, have you got the answer ? because i also face problem !!!
@@iamaniketkr yes i got it
@@AkashRaj-if6di whats thE solution
Texutils directory ke andhar ek aur directory kaise banaaya aapne
Harry bhai plzzz explain
i got error when ever i add another section like harry add about then I got error like can't reach file 127.0.0 refused to connect. please help me harry sir.
use Comma( , ) before path like ,path('about',views.about,name='about')
sol:
def index(request):
try:
f = open('name.txt', 'w')
f.write('Hello World, how are you?')
except Exception as e:
print(e)
try:
f = open('name.txt', 'r')
return HttpResponse(f.read())
except Exception as e:
print(e)
i'm having one issue. i'm running the same steps as shown in the video but hello is not printing. it is always showing the django admin page. what can I do?
The same people occurred to me, after saving your work, try resorting your computer and opening Pycharm again, when the same prob occurs to me i gave up & then after a few days, I opened my project, reloaded (by saving), it worked for me
hahaha ye to jaadu ho gya
@@ladydimitrescu1155 did you get the solution for this? why did this problem occur? we need a quick solution for this.
@@ananyavats6914 i am also getting the same problem. may be there is some changes in updated 3.0 version due to which we are getting this problem.
You should restart your PC, I also faced such problem, when I restart my PC, it solved
we are going to raise the bar
Sir I have a problem occurs in our file is C:/New folder/37/python.exe: can't open file 'C://Users//abc//textutilise//manage.py': [Error 2] No such file or directory
cd textutilise
After that....
python manage.py runserver
hy I am not getting this hello printing in my website it is only showing that default website of django please tell me why
Close your windows powershell and then try from pycharm terminal
Hi, i am facing a problem while running server. when i save the code then i click on refresh but code is not working. only it shows first screen of congrats! message. plz help to fix it.
Same prob
Same here...
What to do next @harry bhai
Outstanding explanation 😍
Maza aa gya Harry Bhai...
You are Good Trainer Thanks For Making such tutorials
I have done the exercise by making a simple function using with open block and read the text file and save it in a variable and return it as a http response
Harry Bhai?
Thank you... many many many Thank you
Great Start
from django.http import HttpResponse
def index(request):
with open("filepath/one.txt",'r') as f:
var = f.read()
return HttpResponse(var)
superb harry bro..👌
from django.http import HttpResponse
def index(request):
f=open("textutils/1.txt")
filecontent=f.read()
return HttpResponse(filecontent)
*Sir me jab **manage.py** ka server run karta hun to wo run ho jata hai.. uske bad agar mene code me koi glti kardi to or browser pe reload kiya to "error loading page" ata hai or phir server chalta he nahi hai.. cmd ko restart kar k server chalana prta hai. Or sir na about ka page open ho raha hai or na home page pe code change karny se changing aarahi*
Def view (request):
File=open("io.txt",'r')
return HttpResponse(file.readlines())
Url patterns=[
path(' ',io )
]
I have some problem while executing. Can you help me so
I was able to complete your assignment using Path from pathlib and read the txt file stored in the same folder and manage,py and then passing the string into the return HTTPResponse function
Thanks Buddy😘😘
Can anyone help me (Harry bhai aapne text utils ke andar text utils kaisr gaye
i have the same question. how to go to textutils inside the textutils
def index(request):
f = open("1.txt", "r")
f1 = f.readlines()
y = ""
for x in f1:
y += x
return HttpResponse(y)
The video got cut @ 1:52. We're facing a problem because of that. I've got stuck here for 2 days. please resolve.
I am having same problems.. anyone please please help me??
I am having same problems.. anyone please please help me??
Good job herry
def index(request):
file=open("terms.txt",'r')
return HttpResponse(file.readlines())
Can also use
with open
quiz ans = i will use open() to read file content and use that content in
Httpresponse
My code is running fine and i am also getting the correct output in the browser but my terminal shows 7-8 errors after closing/minimizing the browser.
Is it only me or others are getting the same errors too??
How to get inside your current file using the terminal? I am not able to go to manage.py because I am not able to get into the right file, can anyone help me, please?
def index(request):
with open("one.txt") as f:
return HttpResponse(f.read())
ASSIGNMENT Solution :
def text(request):
f = open('./textutils/one.txt', 'r')
file_content = f.read()
f.close()
return HttpResponse(file_content, content_type="text/plain")
1:55 how did you get inside the textutils directory
Brother use cd textutiles correctly it will be run perfectly.
@@yashchetwani2891 thanks
Harry bhai, all code are same but its giving this error-ImportError: cannot import name 'views'.....where is the problem.
got resolved.
How u got solution?
@@abhikr6916 solution pls
Nice 👍👏😊
from django.http import HttpResponse
def display_file():
with open('abc.txt') as f:
for i in f:
return (i)
def index(request):
return HttpResponse(display_file())
def about(request):
return HttpResponse("about myself abc")
exercise ka ans-
views wale file mein:
def text(request):
readfile = open('test.txt')
areaded = readfile.readlines()
return HttpResponse(areaded)
aur urls wale file mein:
path('text/', views.text, name='text')
Using the URLconf defined in mysite.urls, Django tried these URL patterns, in this order:
admin/
The current path, about, didn't match any of these.
I got the same error,how did it solved?
bhai 5:52 pe mere webpage pe koi text reflect nai ho ra h, same rocket bani hui h, any suggestions?
Close the powershell or cmd and run in pycharm terminal
Awesome tutorial sirji
def index(request):
f = open('textutils/1.txt', 'r')
contents = f.read()
return HttpResponse(contents)
def file(requet):
with open('one.txt','w') as f:
f.write("This is file content")
with open("one.txt") as f:
return HttpResponse(f.read())
path('', vfir.file, name='file')
First we will open it in read mode with "open" function and read the content with read function and then return it in html response....
iam form Pakistan big fan sir love you
Sorry for delay thoda bahar chala gya tha. The approach will be to open the file first using open() method then read the contents of the file and save to a variable like content = f.read() then simply pass this content variable into the HttpResponse() method to display the actual content of the file. I tried with HTML code and it worked unexpectedly really well.
Hi Can you tell me the deailed answer of the quiz because its confusing me?
Im very new to it and i dont know the where i have to write this
Awesome bro 🌹