Question: -Mac OSX 10.7.5
-Python 2.7 
-PostgreSQL 9.3.2 (set up via Heroku)
-Django 1.6

I've spent the entire day trying to solve this problem and have not been able to find a solution. I'm trying to get my Django app to recognize a Postgres database. The database setting in my django settings.py is 

```
DATABASES = {
'default': {
    'ENGINE': 'django.db.backends.postgresql_psycopg2',
}

```

}

The first thing I did to get psycopg2 installed was download Macports, which was successful.Then in the terminal I typed 

sudo port install py27-psycopg2 

I didn't get any error messages, so assumed the install was successful. 

Just to check I fired up the python shell and did:

```
>>import psycopg2

```

That produced the following error:

```
ImportError: No module named psycopg2

```

I retyped "sudo port install py27-psycopg2" but got this:

```
usage: install [-bCcpSsv] [-B suffix] [-f flags] [-g group] [-m mode]
           [-o owner] file1 file2
   install [-bCcpSsv] [-B suffix] [-f flags] [-g group] [-m mode]
           [-o owner] file1 ... fileN directory
   install -d [-v] [-g group] [-m mode] [-o owner] directory ...

```

Does anybody know what might be going on here? I did read that Macports installs a different version of python and I'm wondering if perhaps my current version of python isn't recognizing psycopg2. If so, how do I activate the Macports version and would it recognize my django app?

Answer: 
You should use the [enum.Parse](http://msdn.microsoft.com/en-us/library/essfb559(v=vs.110).aspx) Method:

```
MyEnum myEnum = (MyEnum)Enum.Parse(typeof(MyEnum), enumString);

```

I found the [code snippet](http://dotnet-snippets.de/snippet/string-zu-enum/1012).
I really would recommend storing the numerical values rather than the text values in the database. If you want the text values in the database too then add a table for it. Regardless, the Enum.Parse and .TryParse methods will convert a String and the .ToObject method will convert either text or numbers.