Reputation: 2513
I am somewhat new to coding and wanted to start my first Django app with a MySQL backend. I've used this setup for almost a year now on my windows machine, but it was an inherited codebase - and I unfortunately never tried to build a new app from scratch. Furthermore, I recently purchased a used MacBook to familiarize myself with the OS and get more accustomed to using Unix (since all of our code runs from Ubuntu/RedHat servers) - so I'm still in the 'finding out how to get around town' phase.
Below are some of the difficulties/errors I ran into, and the answers that worked for me (and weren't necessarily that easy to find). This is not 'This is how you should solve this problem', but merely a repository for how I resolved some issues - and hopefully learn how I should have done it. Feel free to add more!
Change the default Python Version
export PATH=/usr/bin:$PATH
. This only worked for my current terminal shell - not that helpful.
ln -f -s 2.7/ Current
but this didn't work. I ultimately moved my Current dir to Current_back then created the new symlink ln -s 2.7/ Current
MySQL
mysql_config.path = "/usr/local/mysql/bin/mysql_config"
but I ultimately had to change this in the site.cfg file.DYLD_LIBRARY_PATH=/usr/local/mysql/lib:$DYLD_LIBRARY_PATH
Django
from data1 import *
from data2 import *
o
class Data(models.Model):
foo = models.CharField(max_length=200)
class Meta:
app_label = 'app_name'
Upvotes: 3
Views: 450
Reputation: 3093
brew install python mysql
easy_install pip
pip install virtualenv virtualenvwrapper
echo "source /usr/local/bin/virtualenvwrapper.sh > /dev/null" >> ~/.bash_profile
source ~/.bash_profile
mkvirtualenv --no-site-packages <your env name>
pip install django
Upvotes: 0
Reputation: 22776
Learn how to use Vagrant + Virtual Box, and develop your Django sites in the same environment as your production.
Upvotes: 2