Closed AbdealiLoKo closed 10 years ago
hav push after changes.. is it enough if the file name is directly given?
Hey, can you please give a reference next time ? Kinda difficult to track the lines every time (easier with a link)
So, https://github.com/The-WebOps-Club/offline_github/blob/master/project1/settings.py#L116 Shows that TEMPLATE_DIRS is now a string.
See, If you ran it, it should've given some error ...
TEMPLATE_DIRS is a tuple. A tuple is like a constant array.
But, by setting TEMPLATE_DIRS=os.path.join(PROJECT_PATH,'templates')
TEMPLATE_DIRS is now a string variable. So, it will get confused thinking why is it not a list/tuple.
Also ... the PROJECT_PATH=os.path.abspath(os.path.dirname('project1'))
will not work.
Did you try running it in a python shell or a django shell ?
updated project1 again ,try to run it and see whether everything is working now...
On Mon, May 26, 2014 at 7:09 PM, AbdealiJK notifications@github.com wrote:
Also ... the PROJECT_PATH=os.path.abspath(os.path.dirname('project1'))will not work. Did you try running it in a python shell or a django shell ?
— Reply to this email directly or view it on GitHubhttps://github.com/The-WebOps-Club/offline_github/issues/5#issuecomment-44189861 .
So, settings.py is a kind of tricky file. As every person will have their own settings.
Most stuff like "setting path for django templates" (TEMPLATE_DIRS) can be made properly using the
os
module of python The best way that I have seen to do this is : make your own variable : PROJECT_PATH in settings.pyThe os.path.dirname will give the path of the file. and abspath will give the path with /home/...../project1
Now, if you want to set templates folder as the /home/..../..../project1/templates, you only need to do :
as the join command will appropriately add the word templates to PROJECT_PATH and it will handle all the / before, after, double / and all that stuff.
So, right now https://github.com/The-WebOps-Club/offline_github/blob/master/project1/settings.py#L113 shows that /home/keerthana/ is there in the project. And that line will definitely not work in my laptop. So, let's make it proper ?