Installation - syncdb error

84 views
Skip to first unread message

Thurston County Planning

unread,
Oct 11, 2013, 4:10:29 PM10/11/13
to opentree...@googlegroups.com
Still going along with the Vagrant-based install guide and everything was going pretty smoothly until I got to the syncdb step (step 12 - run "python manage.py syncdb"). It gave me an error saying that SITE_ROOT isn't defined. But when I look into the .py files, everything appears to be as it should, so I'm not sure where the error is coming from.

Here's the exact error I'm getting back in Bash:

Traceback (most recent call last):
     File "manage.py", line 4, in <module>
          import settings # Assumed to be in the same directory.
     File "/var/projects/otm/OpenTreeMap/settings.py", line 171, in <module>
          if SITE_ROOT is not "/":
NameError: name 'SITE_ROOT' is not defined

Does anyone have an idea about what I might be missing?

Thanks,
Josh

Keith Bornhorst

unread,
Oct 11, 2013, 4:20:35 PM10/11/13
to opentree...@googlegroups.com
The settings.py file should import all your implementation-specific (Thurston County) settings. In step 10, did you create a local_settings.py file? It looks like the current settings.py (as I see in github/master) doesn't import your settings/overrides.

I think if you add (at or near the bottom of settings.py) you should be able to move forward a bit farter:

try:
    from local_settings import *
except ImportError, exp:
    pass

Good luck - let us know how it goes,
Keith

Keith Bornhorst

unread,
Oct 11, 2013, 4:22:32 PM10/11/13
to opentree...@googlegroups.com
Actually, it looks like the current settings.py DOES import settings, but it's looking for impl_settings.py - you might just need to rename your settings file...

Thurston County Planning

unread,
Oct 11, 2013, 5:16:09 PM10/11/13
to opentree...@googlegroups.com
Thanks Keith. It looks like it has both - on line 83 it's trying to import from impl_settings, but then at the end on line 167 it looks to import local_settings. So it seems like both cases should be covered (though there isn't actually an impl_settings file). Maybe I'll try getting rid of the impl_settings code since it seems to be redundant/obsolete and see what happens.

To answer your original question, I did create the local_settings.py file. The local_settings.py, manage.py, and settings.py are all in the OpenTreeMap directory and they all appear to be pointing to one another correctly.

In my local_settings file, I left the SITE_ROOT definition as it was (just a slash), which seems like it should be fine.

Anything else seem amiss?

Keith Bornhorst

unread,
Oct 11, 2013, 5:29:33 PM10/11/13
to opentree...@googlegroups.com
83 - import impl_settings
167 - import local_settings
171 - error SITE_ROOT not defined

Without seeing your setting files, it looks like that should do it...

Not a python guy, but... maybe comment out (#) the try/else and see if the "import local_settings" call throws an error/exception? Python needs tabs, not spaces, I think - double check? Do you see a compiled version of your settings files? Maybe delete the .pycs? (Again, not a python guy so that may do absolutely nothing, sorry).

To move forward you could try copying the contents of your local settings into settings just to move on to the (inevitable) next issue :)

Can't think of anything else, but it IS Friday... Good luck,
Keith


Thurston County Planning

unread,
Oct 11, 2013, 6:18:04 PM10/11/13
to opentree...@googlegroups.com
Hmmm, I tried various combinations of commenting out the import code blocks, manually adding LOGIN_URL to local_settings, pasting local_settings into settings, deleting the compiled files for both local_settings and settings. Sadly, none of it worked. I think it's trying to tell me to start my weekend early ;)

Andrew Thompson

unread,
Oct 15, 2013, 11:45:24 AM10/15/13
to opentree...@googlegroups.com
Hi Josh,

This issue has come up for various people trying to implement OTM in the past, though I haven't encountered it myself and I'm not sure if we've ever found/heard/documented a final solution. I do think people have conquered it before though. There are a few older threads you could hunt in for clues, caveat being that they're older and might be referring to code that is no longer applicable:



Also, we have an older install document that detailed a step to take if you get errors with the "syncdb" command:


That doesn't seem to pertain to the SITE_ROOT error, but worth checking anyway.

Also, are you familiar with Github? Perhaps you could try creating a fork of the OTM repository / creating your own repo so we could see and comment on your specific code. It's tough to diagnose these things without seeing everything in context.

Thanks,

Andrew


--
You received this message because you are subscribed to the Google Groups "opentreemap-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to opentreemap-us...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
Andrew Thompson, Community Evangelist

Azavea |  340 N 12th St, Ste 402, Philadelphia, PA
atho...@azavea.com  | T 215.701.7689  | F 215.925.2663
Web azavea.com  |  Blog azavea.com/blogs  | Twitter @azavea

Join our community! Google Groups:

Thurston County Planning

unread,
Oct 15, 2013, 1:34:23 PM10/15/13
to opentree...@googlegroups.com
Hey Andrew,

Thanks for the input. I did search the forums before posting, but had missed a couple of those posts, so I appreciate the links. It appears that most of the definitive suggestions have already been incorporated into the base code, so I'm still stumped for the time being.

  • The suggested addition from Adam Hinz in the first link is already a part of the local_settings.py file, the only difference being I don't have any values to put in the Tilecache or Geoserver settings - but I don't think those would cause this particular error
  • The code from the old install guide under "If You Get Errors" was also already in the local_settings.py

I'm a total Github noob, but starting to learn. I haven't gotten to the point yet where I've really made any modifications from the base files since I'm still just trying to stand up a generic "proof of concept" on a virtual machine (want to be able to tell my higher ups with confidence that we can actually get this working before asking for more resources). If I can get far enough that I start to do any customization/localization then I'll definitely look into putting it up publicly.

I think my next step is slowly going back through the python files with a fine-toothed comb and see if there's anything I might have missed. I'll post back if I make any breakthroughs. If not, then maybe I'll just hold my breath for OTM2  :D

Josh

Alan Humphrey

unread,
Oct 15, 2013, 3:59:38 PM10/15/13
to opentree...@googlegroups.com
You may not be running the manage.py you think you are. Try this from the command line:

python ./manage.py syncdb

As an experiment you can also explicitly set SITE_ROOT

Alan Humphrey

unread,
Oct 15, 2013, 4:01:21 PM10/15/13
to opentree...@googlegroups.com
(too fast on the send...)
set SITE_ROOT just before the test in settings.py and see if that helps things.

Thurston County Planning

unread,
Oct 23, 2013, 4:49:07 PM10/23/13
to opentree...@googlegroups.com
Thanks Alan, I tried your two suggestions, but still no joy. Defining SITE_ROOT in settings.py did get rid of the original errors, but then I got a lot more different errors - so maybe I'm looking at some deeper-rooted problems.

Josh

Keith Bornhorst

unread,
Oct 28, 2013, 8:25:54 AM10/28/13
to opentree...@googlegroups.com
Josh,

For fun, I stepped through the Vagrant-based install guide this weekend and I too am getting the same NameError referencing SITE_ROOT.

Machine: Windows 8.1, 64bit
Software: Vagrant 1.3.5, VirtualBox 4.3.0, PUTTY 0.63

There were a few typos that I fixed in the install guide, but otherwise every single step seemed to run fine. Until Step 12.

I'll investigate further when I have time later today, but wanted to let you know that someone else can replicate your issue.

Cheers,
Keith

Keith Bornhorst

unread,
Oct 28, 2013, 1:05:34 PM10/28/13
to opentree...@googlegroups.com
Alright, it looks like we're seeing an import error within local_settings.py with respect to CHOICES. Step 11 of the Vagrant-based install docs concatenates choices.example.py to the end of local_settings.py. The local_settings.example.py file is still trying to import choices.py.

The quick fix will be to edit your local_settings.py file and comment out the choices import
#from choices import *

After doing that you should be good to continue.

I submitted a pull request to comment out that import from the local_settings.example.py file, but I'll let Andrew decide if the import or the concatenation works best with his installation instructions.

Have a good one,
Keith

Thurston County Planning

unread,
Oct 29, 2013, 3:36:36 PM10/29/13
to opentree...@googlegroups.com
Awesome Keith! That made perfect sense (probably should have seen it myself) and got me past the errors!

Keeping my fingers crossed that the rest of the setup process is uneventful...

Thanks for your help!
Josh

Andrew Thompson

unread,
Oct 29, 2013, 5:11:58 PM10/29/13
to opentree...@googlegroups.com
Hi Keith,

Thanks so much for your diagnosis of the problem, and your pull request. However, instead of merging your pull request, I've modified my install guide instead to keep choices.py as a separate file and not concatenated to local_settings.py. The concatenation step was my early mistake - it mashes two files that serve their own purposes into one, which feels messier than it has to be. Also, getting rid of the import statement would break our deployment tools for various production OTMs like GreenprintMaps, PhillyTreeMap and so on.

Keeping choices.py separate and importing it should get rid of the errors all the same, and more closely mirrors how Azavea deploys production treemaps. Longer term, we should handle imports in a less brittle way, and we've opened issue 171 to reflect that.

At any rate, glad your problems seem to be behind you, Josh!

Thanks all,

Andrew


--
You received this message because you are subscribed to the Google Groups "opentreemap-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to opentreemap-us...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Gonz Rafuls

unread,
Oct 3, 2014, 9:08:49 AM10/3/14
to opentree...@googlegroups.com
Hi Guys,

Not sure if it is still relevant but I came across this same issue while going through the OTM2 installation guide.
I fixed this by copying the local_settings.py to the settings directory:

cd /usr/local/otm/app/opentreemap/opentreemap
cp local_settings.py settings/

If this is the correct fix, you might want to update the installation guide to wget this to the settings folder directly although I am not sure if later django is looking for the local_settings.py under the opentreemap directory.

Cheers,
Gonza.-

Andrew Thompson

unread,
Oct 3, 2014, 11:41:37 AM10/3/14
to opentree...@googlegroups.com
Hi Gonza,

Thanks for pointing this out. This is because of a recent change. I've just submitted a pull request to the otm2-vagrant project, and once it's merged in I will update the Installation Guide accordingly.

Thanks!

-Andrew

--
You received this message because you are subscribed to the Google Groups "opentreemap-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to opentreemap-us...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages