On Mon, Nov 19, 2012 at 6:40 PM, Luisa Beck <emmi.b...@gmail.com> wrote:

> Hi, I'm new to web development and I'm trying to get my mac set up for
> doing the tutorials.
> I installed postgres and pgAdmin III and set it up on the default port
> (5433). I created a test database. Now when I try to open it on the local
> server, I get an error message: 'ERROR: column "datconfig" does not exist
> LINE1:...b.dattablespace AS spcoid, spcname, datallowconn, dataconfig,...
>
> Here is what I did before I closed pgAdmin and then reopened it:
>
>    - Installation: The Setup told me that an existing data directory was
>    found at /Library/PostgreSQL/9.2/data set to use port 5433.
>    - I loaded an .sql file that I wanted to test (I saved it on my
>    desktop and loaded it into the database from there).
>
> Also, I'm having trouble entering freenode because it says that " #Django 
> Cannot
> join channel (+r) - you need to be identified with services"
>
> And lastly, if someone could forward me a tutorial about how the
> databases, python files,
> virtual environments and Django work together (I am new to all of these)
> that would be much appreciated!
>
> Thanks in advance!
> Luisa
>
>
> I'm no Mac expert, but I'll offer a couple of thoughts.

First, you shouldn't need to solve both the PostgreSQL installation issue
and learning Django at the same time.  sqlite3 is adequate to the tutorial,
and is built in to modern pythons (e.g.; 2.7), and I presume that's true on
the Mac as well.

Django is written in Python, which requires no pre-compilation, but must be
run with a python interpreter, e.g.; "python manage.py runserver" at the
command line.  The tutorial is written with the assumption that you will be
running it from the command line.  If you have more than one python
installed on your system, you can specify which one to use by including the
path on the command line, such as "~/bin/python manage.py runserver", or
you can adjust your $PATH environment variable so that the correct python
occurs first on the path.  This last is what virtualenv does: the activate
code (which you must "source", not run, e.g.; "source
~/venvs/djtutorial/bin/activate") adjusts the PATH (and prompt) of the
shell that sources it so that the virtualenv's python is found first*, and
defines a "deactivate" shell function that will undo the changes (exiting
the shell is just as good - i.e., this will not last across a reboot, you
must activate each new shell - command line window - that you start to work
on this project).  Python figures out where you ran it from, and searches
from there for it's libraries, and finds first those associated with the
virtualenv, e.g. "~/venvs/djtutorial/lib/python2.7/".  This means that you
can install things there (e.g.; by using "pip install ..." from a shell
that has been activated for that virtualenv) and they won't effect your
base python installation.

[ * Perhaps not commonly understood, you don't need to activate if you
specify the path to the correct python, e.g.;
"~/venvs/djtutorial/bin/python manage.py runserver", so it is easy to
create a shell script or even an alias that does your most common stuff.
For example, you might make a copy of manage.py, maybe called "manage", add
a first line with the magic incantation:

#!/absolute/path/to/the/correct/python

Then make that file executable ("chmod a+x manage") and you will be able to
do "./manage runserver", etc., whether or not you have activated in the
current shell.  (I specifically recommend against putting the project
directory on your path, thus the "./" part.) ]

For most databases Django connects to the database's socket to
communicate.  For sqlite3 the code is running within your python
interpreter and it reads and writes the specified file for persistence.
Django's ORM maps models onto database tables and the fields of the model
onto the columns of the table, and provides the "syncdb" command for
initializing the tables.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to