Thursday, August 5, 2010

test

Another working day in IT

Another day in IT.

[100805 11:47]
PyCharm/Django...created index html file '/templates/index.html'.
...not found but nice error message from Django (I think) about regexes
tested. added line in urls.py file:

(r'.*', include(admin.site.urls)),

after dimissing a PyCharm internal error, /index.html shows; stacktrace at
http://127.0.0.1:8080/index.html (configged to auto-open in browser, nice):

[...]
File "/Library/Python/2.5/site-packages/django/db/backends/dummy/base.py", line 15, in complain
raise ImproperlyConfigured("You haven't set the database ENGINE setting yet.")

so it accesses DB even tho the index.html has _nothing_ django-specific? or
does it simply check config always?

[100805 12:18]
settings.py:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'ppmondj', # Or path to database file if using sqlite3.
'USER': '', # Not used with sqlite3.
'PASSWORD': '', # Not used with sqlite3.
'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
'PORT': '', # Set to empty string for default. Not used with sqlite3.
}
}

...wt*:
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named MySQLdb

[100805 12:28]
well..., G->

[http://stackoverflow.com/questions/268025/install-mysqldb-for-python-as-non-compressed-egg]
calling easy_install -Z mysql_python from the command prompt, finds the
egg on the net and installs it.

[100805 12:30]
nice:
$ easy_install -Z mysql_python
Searching for mysql-python
Reading http://pypi.python.org/simple/mysql_python/
Reading http://sourceforge.net/projects/mysql-python/
Reading http://sourceforge.net/projects/mysql-python
Best match: MySQL-python 1.2.3
Downloading http://download.sourceforge.net/sourceforge/mysql-python/MySQL-python-1.2.3.tar.gz
Processing MySQL-python-1.2.3.tar.gz
Running MySQL-python-1.2.3/setup.py -q bdist_egg --dist-dir /var/folders/yS/ySwzLqWTFJiTPleKRiIU7U+++TI/-Tmp-/easy_install-oUgb6M/MySQL-python-1.2.3/egg-dist-tmp-KpbQZ0
warning: no files found matching 'MANIFEST'
warning: no files found matching 'ChangeLog'
warning: no files found matching 'GPL'
zip_safe flag not set; analyzing archive contents...
Adding MySQL-python 1.2.3 to easy-install.pth file

Installed /Library/Python/2.5/site-packages/MySQL_python-1.2.3-py2.5-macosx-10.5-i386.egg
Processing dependencies for mysql-python
Finished processing dependencies for mysql-python

[100805 12:31]
still no go in PyCharm. wt*. console:

ImportError: dlopen(/Library/Python/2.5/site-packages/MySQL_python-1.2.3-py2.5-macosx-10.5-i386.egg/_mysql.so, 2): no suitable image found. Did find:
/Library/Python/2.5/site-packages/MySQL_python-1.2.3-py2.5-macosx-10.5-i386.egg/_mysql.so: mach-o, but wrong architecture

[100805 12:34]
G "_mysql.so: mach-o, but wrong architecture" ->

[http://birdhouse.org/blog/2009/02/21/python-mysql-connections-on-mac-os/]
"In all of Mac-dom, there are few experiences more painful than trying
to get Python tools to talk to a MySQL database" ... "But try to get up
and running with Django, TurboGears, or any other Python package where
MySQL database access could be useful (or needed), and you’re in for a
world of hurt."

great...

-- EDIT --
Trying the '/opt/local/bin/port install py25-mysql' route. Takes forever, so blog-time, or lunch time perhaps. "Ironically", I didn't really want to use a DB right now, just get a site for some test/monitoring up quickly. 
later...
On Mac OS X 10.5, zlib 1.2.5 requires Xcode 3.1 or later but you have Xcode 3.0. Error: Target org.macports.extract returned: incompatible Xcode version Log for zlib is at: /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_ports_archivers_zlib/main.log Error: Problem while installing zlib Error: Unable to execute port: upgrade python25 failed 

-- Somewhat Later Still --

Re: Xcode 3.0 -> 3.1 or 3.1.1 upgrade

Posted: Nov 6, 2008 5:51 PM in response to: spiderpig

Helpful


Nope. You have to download the whole thing all over again. Maybe someday Apple will actually implement updates for XCode. Then again, how many years have we been begging for that feature?

...postgresql? http://shifteleven.com/articles/2008/03/21/installing-postgresql-on-leopard-using-macports
-- even later that day --

Used the sqlite3 (built in to Django, it seems). Lesson I never seem to really learn: do the simplest thing possible when trying a new product. Use the default project, don't change one letter. Don't be tempted for a second to think like "I'll just try this instead, I've already got mysql, so I'll just try that, and just run the thing". I've heard Django being touted for it's very mature, high-quality docs, so that should have been the starting point. In my defence, the file did not have the sqlite3 DB name filled in, so you actually had to change the letter. The again, doc says: "If you're new to databases, we recommend simply using SQLite (by setting ENGINE to 'django.db.backends.sqlite3')." They could've said "If you've new to Django"...


[100805 16:35]

did:

python manage.py startapp monitor

nice, created what I suppose is a site folder.

not-so-nice: 'http://127.0.0.1:8080/monitor/' shows error. Seems it didn't

add anything to the urls.py file; that could be the problem.


--- quarter-to-sixish ---


Perhaps best to wrap up this thing a little...

I didn't intend it to be an all-day thing -- but why not; just intended to give a little glimpse of the fun-funnery involved in computer work.

It's not all bad, especially in such a nice office space and office people that I have the luck to be working in.

And you learn eventually. For instance how to set up a Django project.


...got to go, more later.



Monday, August 2, 2010

Some projects cannot be imported

Said Eclipse: "Some projects cannot be imported because they already exist in the workspace".


Which means: "Some projects cannot be imported because project/s of the SAME NAME already exist/s in the workspace."


Which implies that you also can't import two checkouts of the same project. Which would be useful if you want to run, say, a trunk and a branch version of the same project at the same time. Without using two Eclipse instances.


A solution, sort of: rename the existing project; if project's name is ProjectName, rename it ProjectNameTrunk. The .project file will look like this:


<projectDescription>

<name>ProjectNameTrunk</name>

[...]

</projectDescription>


After this, you can import your branch (or other project of same name).


-- edit --

Hm: SVN checkout dialog has a 'project name' box to fill in. Wish it could

fill in the name of the folder checked out.