- CentOS 5.2
- MySQL 5
- Python 2.6
- Django 1.02
- Python: MySQLDB
- Python: PIL
Monday, April 6, 2009
Things you need for Hosting...
Ok I need to keep track things I need for Hosting... This list is going to change but I'm going to start forgetting things...
Pyjamas III
Pyjamas was installed correctly all along. So what we learned here is that you can't confirm it's correctness by running the interactive interpreter. Go ahead and write a python source file and build it using pyjsbuild and see if your output functions properly.
Boy that was all a big waste of time...
Boy that was all a big waste of time...
Thursday, April 2, 2009
Pyjamas II
Ok. I dont know if this works right. I could have been doing something wrong last weekend. I thought I'd try to install Pyjamas as the instructions told you, then go through and try to verify it like I did with Django. No go. I tried "from pyjamas import Window" (which is the first line in like all of the examples). I kept getting errors like the following:
Python 2.6.1 (r261:67515, Mar 27 2009, 23:42:53)
[GCC 4.1.2 20071124 (Red Hat 4.1.2-42)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from pyjamas import Window
Traceback (most recent call last):
File "", line 1, in
ImportError: No module named pyjamas
I then appended /usr/share/pyjamas to the PYTHONPATH and got a little further...
>>> from pyjamas import Window
Traceback (most recent call last):
File "", line 1, in
File "/usr/share/pyjamas/library/pyjamas/__init__.py", line 1, in
import DOM
File "/usr/share/pyjamas/library/DOM.py", line 15, in
from __pyjamas__ import JS
ImportError: cannot import name JS
But it still won't work. I don't think it's supposed to work in the interactive python environment... Maybe it is - but I tried to run pyjsbuild on a test.py file that just imported the Window class from pyjamas and ran it. That ran successfully and created the proper output.
Note: pyjsbuild was looking for files in /usr/local/share/pyjamas/builder , but these files were all installed to /usr/share/pyjamas/builder. So I create a symbolic link under /usr/local/share that pointed to /usr/share. Don't know if it was the right thing to do or not... This will be yet another system change to make for hosting if this needs to be done.
Next step: Run real test apps through Pyjamas to see if it's correct. Hoping for now that it is.
Python 2.6.1 (r261:67515, Mar 27 2009, 23:42:53)
[GCC 4.1.2 20071124 (Red Hat 4.1.2-42)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from pyjamas import Window
Traceback (most recent call last):
File "
ImportError: No module named pyjamas
I then appended /usr/share/pyjamas to the PYTHONPATH and got a little further...
>>> from pyjamas import Window
Traceback (most recent call last):
File "
File "/usr/share/pyjamas/library/pyjamas/__init__.py", line 1, in
import DOM
File "/usr/share/pyjamas/library/DOM.py", line 15, in
from __pyjamas__ import JS
ImportError: cannot import name JS
But it still won't work. I don't think it's supposed to work in the interactive python environment... Maybe it is - but I tried to run pyjsbuild on a test.py file that just imported the Window class from pyjamas and ran it. That ran successfully and created the proper output.
Note: pyjsbuild was looking for files in /usr/local/share/pyjamas/builder , but these files were all installed to /usr/share/pyjamas/builder. So I create a symbolic link under /usr/local/share that pointed to /usr/share. Don't know if it was the right thing to do or not... This will be yet another system change to make for hosting if this needs to be done.
Next step: Run real test apps through Pyjamas to see if it's correct. Hoping for now that it is.
Sunday, March 29, 2009
Django Installed, Pyjamas Not...
The Django Story
So I got Django 1.0 installed. That was very easy. Thanks to the team for making that happen so easily. No need to say much else - just follow the instructions. Verification is very easy by loading up python2.6 and typing "import django" to make sure everything is setup right.
The Pyjamas Story
So I haven't talked about Pyjamas yet, but I decided to go with it as the UI platform/Library as GWT looks very usable for what we're looking to do. Plus our UI designers liked to use the GWT demos for the site design. So I tried to install Pyjamas by going to pyjs.org and downloading the package. I can't get it to work just yet... But here are my notes so far:
So I got Django 1.0 installed. That was very easy. Thanks to the team for making that happen so easily. No need to say much else - just follow the instructions. Verification is very easy by loading up python2.6 and typing "import django" to make sure everything is setup right.
The Pyjamas Story
So I haven't talked about Pyjamas yet, but I decided to go with it as the UI platform/Library as GWT looks very usable for what we're looking to do. Plus our UI designers liked to use the GWT demos for the site design. So I tried to install Pyjamas by going to pyjs.org and downloading the package. I can't get it to work just yet... But here are my notes so far:
- Download setuptools before downloading pyjamas. You need it to install it, no way around it - so go ahead and get it. Make sure you download the right one for your python version... In my case 2.6.
Saturday, March 28, 2009
Setting up a Django Server for Dev/Hosting I
As previously stated, I'm way out of touch and struggling to do things that most consider obvious. But the journey's the fun part anyway (I keep telling myself). These "Setting up a Django Server for Dev/Hosting" posts are going to be answers to questions I have about getting the environment ready for dev and hosting. (Since we're 4 months from release).
Assumption #1. CentOS is the server OS
Going to release on CentOS 5.2 Why? It's free and considered "server" and very stable and well tested. I dont want to take chances with OS issues, so I love "Mr. Stability". Problem is, I found that an idiot like me can take down the whole server where it requires a complete re-install within 10 minutes...
Assumption #2. I want the terminal Python release for my Django Projects
Why do I want terminal releases? In my 15 years of development experience, terminal releases are usually rock solid (at least compared to the other releases). So I'm going with Python 2.6.1 for my websites. But... CentOS 5.2 comes with Python 2.4...
Answer/Lesson. Well just install 2.6.1 on CentOS 5!
Duh! That was easy and probably obvious. But... "Don't do it". Well, "Do it, but be really careful". So in updating CentOS 5, it's very simple to just download the Python 2.6 source and compile it as the instructions say and then install it as the system python binary. The problem is when I rebooted the system wouldn't get past the GRUB loader. I think it never even shut down correctly as it failed to run some python scripts with the 2.6 binary.
UGH! I had setup a lot of stuff (Eclipse, PyDEV, etc...) and now I had to reinstall the OS from scratch (I tried to just install on top but this failed permanently too). After I got my blood pressure back down from it's peak, I tried again - downloaded python 2.6, compiled it, and installed it. BUT - this time I was careful to change the link to python in /usr/bin to python2.4 instead of python2.6 (found in usr/local/bin). So the easiest way to verify this is to run python as root and as your user and make sure that it always runs as version 2.4.3. I then ran python2.6 and made sure it always ran as version 2.6.1. Seemed ok so I rebooted.... Everything came back fine this time. WHEW!
Lessons Learned.
Assumption #1. CentOS is the server OS
Going to release on CentOS 5.2 Why? It's free and considered "server" and very stable and well tested. I dont want to take chances with OS issues, so I love "Mr. Stability". Problem is, I found that an idiot like me can take down the whole server where it requires a complete re-install within 10 minutes...
Assumption #2. I want the terminal Python release for my Django Projects
Why do I want terminal releases? In my 15 years of development experience, terminal releases are usually rock solid (at least compared to the other releases). So I'm going with Python 2.6.1 for my websites. But... CentOS 5.2 comes with Python 2.4...
Answer/Lesson. Well just install 2.6.1 on CentOS 5!
Duh! That was easy and probably obvious. But... "Don't do it". Well, "Do it, but be really careful". So in updating CentOS 5, it's very simple to just download the Python 2.6 source and compile it as the instructions say and then install it as the system python binary. The problem is when I rebooted the system wouldn't get past the GRUB loader. I think it never even shut down correctly as it failed to run some python scripts with the 2.6 binary.
UGH! I had setup a lot of stuff (Eclipse, PyDEV, etc...) and now I had to reinstall the OS from scratch (I tried to just install on top but this failed permanently too). After I got my blood pressure back down from it's peak, I tried again - downloaded python 2.6, compiled it, and installed it. BUT - this time I was careful to change the link to python in /usr/bin to python2.4 instead of python2.6 (found in usr/local/bin). So the easiest way to verify this is to run python as root and as your user and make sure that it always runs as version 2.4.3. I then ran python2.6 and made sure it always ran as version 2.6.1. Seemed ok so I rebooted.... Everything came back fine this time. WHEW!
Lessons Learned.
- Don't replace system script libraries with new versions without REALLY knowing what you're doing. (I even saw some websites warn me, I just didn't see how it would break anything!)
- Verify your installs work properly after you've done them. Check things as root and as a user (originally I had different behaviors in the two cases).
- Linux is incredibly easy to break badly. Tread carefully, change as little as possible.
Getting Started Again...
Ok. Time to get started.
Now leaving my job - so now it's time to get serious. I last did web development back in 1995 (I know, how sad is that). So it's time to re-train. Fortunately I've had enough time to try to get re-acquainted with the modern world. Lots of choices, lots of technology, lots of interesting stuff to waste time on.
So we're making a consumer-oriented web service to engage a population that isn't being well served today. Lots of frameworks to pick from: Rails, Java, Django, PHP, etc... Gotta review them quickly and pick one. Went with Django - primarily because it seems pretty straightforward/simple, it appears to scale well, but also because years ago I did enough Python to feel good about using it.
So Django it is... But that's just the first question. What about UI frameworks? What about databases? Answers to come later I guess.
Now leaving my job - so now it's time to get serious. I last did web development back in 1995 (I know, how sad is that). So it's time to re-train. Fortunately I've had enough time to try to get re-acquainted with the modern world. Lots of choices, lots of technology, lots of interesting stuff to waste time on.
So we're making a consumer-oriented web service to engage a population that isn't being well served today. Lots of frameworks to pick from: Rails, Java, Django, PHP, etc... Gotta review them quickly and pick one. Went with Django - primarily because it seems pretty straightforward/simple, it appears to scale well, but also because years ago I did enough Python to feel good about using it.
So Django it is... But that's just the first question. What about UI frameworks? What about databases? Answers to come later I guess.
Subscribe to:
Posts (Atom)