mauiman2 — 2012-07-23T19:04:21-04:00 — #1
I am a pro at front end development but am just now starting on a project that requires first time usage for me of Python/Django/Github as well as MySQL (which I used one time before about four years ago). I have a lot of this set up but have a few newbie questions to ask to get things going for myself here on my own local machine. Would someone be willing to gmail chat with me to help me spread my own wings here or is it preferred that I ask all my questions within the public forum here? I can do it either way. This will just be a matter of finishing off a jigsaw puzzle that is about 85% complete.
stomme_poes — 2012-07-24T09:32:26-04:00 — #2
Public forum is best, mostly because then the conversation is available to all.
However SitePoint's Python/Perl section doesn't seem to get much traffic. The Perl I can see, but why Python isn't discussed so much, I have no idea.
You are working with a Django project that already exists on github? Re the mysql: unless there's a way around it I don't know (and I'm a Django newb), you'll pretty much always be interfacing with Django's API instead of directly with teh DB (Django makes it seem as if you're working with an object-database instead of a relational db).
You might as well also mention what you've got right now on your local machine. Also whether the team you're with prefers you do things in a virtualenv or with a particular version of Python or whatever.
mauiman2 — 2012-07-24T15:11:04-04:00 — #3
Looks like they want it in a virtualenv but I don't even know how to create one. Every time I ask them a question to clarify things their answer actually brings up more questions.
If somebody will help me get this done through a chat I can paste the contents of the completed chat back into this thread.
mauiman2 — 2012-07-24T18:30:17-04:00 — #4
What I'm having trouble with now is getting my system to recognize the path to my Python install. I have precisely followed the directions found here:
yet when trying install the Python setup tools it keeps saying Python is not found in the registry.
stomme_poes — 2012-07-25T06:08:03-04:00 — #5
Oh man, Windows.
Before anything else, is it possible you have a nix box lying around to use for this project? Everything I do with Django, Python, github, etc is done via the commandline, plus every once in a *great while there's something where either there's no Windows version of it, or it works poorly.
Also do you have the version of Windows these instructions reference, or Win7? Are you 32bit or 64bit? I've already found mention of some issues on StackOverflow when searching around.
Virtualenv is pretty nice to have, especially if you're either working on many projects who each need their own version of Python, or working on a *nix machine which has a (different) system Python. With virtualenv, you get a special sandbox with a local Python (so if your system Python was 2.6 and you were working on a project which required 2.7 and another project which needed 3.0+, you could make a virtualenv with Python 2.7 and another with 3.0 while the rest of your system remains untouched. Similarly you can also exclude your system Python packages and only have local packages available... especially good if you need to simulate getting something working on some client's machine who doesn't have the same packages default that you have on your machine).
If nobody here on SitePoint offers to do a chat (I really can't figure anything on Windows), you might want to use the various python irc channels for getting your path etc set up. *nix does this automagically so I've never once had to manually change my PATH variable (yet, fingers crossed).
I'm actually right now setting up a laptop for installing a fresh Django so I'm going to be going through all the motions again (on Debian Linux) today.
stomme_poes — 2012-07-25T08:07:08-04:00 — #6
Just happened to run across this article on LinkedIn's Python Community: http://pythoncentral.org/how-to-install-python-2-7-on-windows-7-python-is-not-recognized-as-an-internal-or-external-command
You don't have that error, but if you're running Win7 it does show a step-by-step to graphically setting your PATH for Python.
mauiman2 — 2012-07-26T02:51:55-04:00 — #7
Thanks for the responses, Stomme poes. I finally got the path to Python working but now when I try to do "python manage.py runserver" I get the following response:
$ python manage.py runserver
Unhandled exception in thread started by <bound method Command.inner_run of <django.core.management.commands.runserver.C
Traceback (most recent call last):
File "c:\\Python27\\lib\\site-packages\\django\\core\\management\\commands\\runserver.py", line 88, in inner_run
File "c:\\Python27\\lib\\site-packages\\django\\core\\management\\base.py", line 249, in validate
num_errors = get_validation_errors(s, app)
File "c:\\Python27\\lib\\site-packages\\django\\core\\management\\validation.py", line 102, in get_validation_errors
connection.validation.validate_field(e, opts, f)
File "c:\\Python27\\lib\\site-packages\\django\\db\\backends\\mysql\\validation.py", line 14, in validate_field
db_version = self.connection.get_server_version()
File "c:\\Python27\\lib\\site-packages\\django\\db\\backends\\mysql\\base.py", line 338, in get_server_version
File "c:\\Python27\\lib\\site-packages\\django\\db\\backends\\__init__.py", line 250, in cursor
cursor = self.make_debug_cursor(self._cursor())
File "c:\\Python27\\lib\\site-packages\\django\\db\\backends\\mysql\\base.py", line 322, in _cursor
self.connection = Database.connect(**kwargs)
File "C:\\Users\\Christian\\AppData\\Roaming\\Python\\Python27\\site-packages\\MySQLdb\\__init__.py", line 81, in Connect
return Connection(*args, **kwargs)
File "C:\\Users\\Christian\\AppData\\Roaming\\Python\\Python27\\site-packages\\MySQLdb\\connections.py", line 187, in __init__
super(Connection, self).__init__(*args, **kwargs2)
_mysql_exceptions.OperationalError: (2003, "Can't connect to MySQL server on 'localhost' (10061)")
even though I do have MySQL installed and running.
stomme_poes — 2012-07-26T08:23:00-04:00 — #8
I searched that error message and found several 'tests'. Did you
-test telnetting to port 3306 to verify mySQL is running (or, you say you know it's running, where did you check that?)
-would Django rather DATABASE_HOST is set to 'localhost' instead of '127.0.0.1'?
-you've checked Windows firewall isn't blocking that port? or, that Django is really given access to that port?
Again, I hope someone who knows Windows shows up because I'm not familiar with it.
endermb — 2013-05-17T05:15:03-04:00 — #9
Have you added the Django calls to your environment variables?