Sphene Community Tools

Community

Copyright © 2007-2018 by Herbert Poul

You are not logged in.
Login
Register

Change Language:



AddThis Social Bookmark Button

A Django site.

Powered by Sphene Community Tools
Board » General » Getting the Tutorial Working in Dev Mode on Windows

Hi All,

I just thought I would post some of the things I had to do to get the tutorial working on windows.

Patching:
Herbert told me that the only patch I needed was: permalink_with_additional_function_arg.diff . Since I am more skilled in Python than SVN, I applied the patch manually. To do this I opened the patch in wordpad. Then I openned the django file: django/db/models/__init__.py
in Idle and changed the code as indicated in the patch file.

Settings.py:
I could not get the python code to figure out how to know where it is running, so I hard coded it (which is not uncommon for the settings file). Also I used the "join" function to build the paths in a OS-independent way. Oh yeah - I renamed the folder that contains the sct to sphene_com_tools. So here is the code:

import sys
from os.path import join
LIB_PATH= r"C:\Documents and Settings\CCM\Desktop\sphene_com_tools\communitytools"
ROOT_PATH = join(LIB_PATH,'examples','simpleproject')

sys.path.append(ROOT_PATH)
sys.path.append(join(LIB_PATH,'sphenecoll'))
sys.path.append(join(LIB_PATH,'libs','markdown'))
sys.path.append(join(LIB_PATH,'libs','custom'))
sys.path.append(join(LIB_PATH,'libs','common'))

TEMPLATE_DIRS = (
join(ROOT_PATH,'sitetemplates'),
join(LIB_PATH,'sphenecoll','templates'),
)

The rest of the install went as per the tutorial.

Happy Sphening,
Chuck
Settings.py:
I could not get the python code to figure out how to know where it is running, so I hard coded it (which is not uncommon for the settings file).
shouldn't __file__ always contain the file path to the current .py / .pyc file ? what does it contain on windows ? i think i found that documented somewhere.. so i've used it :)

as for hard coding stuff.. i don't like that very much because i'm committing my settings.py into subversion and use the same settings.py during development as well as on my server .. and so i wanted to have as few as possible different .. (the only things are actually the database settings which i have in my settings_local.py)

Also I used the "join" function to build the paths in a OS-independent way.


that is a great idea.. i've added that to the issue list: http://code.google.com/p/sct-project/issues/detail?id=21 ;)


thanks for your feedback .. i'll update the tutorial / example configurations with your input :)

cu,
herbert
Hey, we have Signatures !!! Great, isn't it ? ;)
I think whether or not __file__ works depends on how you start the django server. I was starting it from the windows command line using the command:

python manage.py runserver

Under those conditions, __file__ was not defined. It may be possible to find a different command, but I am not sure it is worth the effort.

Also, if you put all the modules into a python package then most of those additions to sys.path will be unnecessary. After that, you can put the package on one of your existing paths (such as the python site_packages folder) and there will be no need to modify the sys.path.

As for keeping your site specific info out of your settings.py file, I think that kind of defeats the purpose of the settings.py file. That said, I use a local_settings.py file that is imported by settings.py just like you mention in your code. The reason I do it is similar to your svn issues. My django site is live, with real customers and everything. So I develop and test things on my local machine before I post them to the live site. There are a couple of settings that are different between my live and dev sites that almost never change on either site (e.g. live DEBUG=False, dev DEBUG=True). My settings.py file changes fairly often. I was finding that when I would post a new settings.py file, I would forget to change these settings for the live site. By splitting the files, that error has gone away.

Just my 2 cents...

Chuck



Please login to post a reply.



Powered by Sphene Community Tools