Being quite new to Django, I need to move the semi-ready
application to the publicly available server (for a company users)
and test it there.
It happened that the Django Turnkey Linux virtual machine
was installed for the purpose by someone else. I have succeeded
to SCP the files there. I can run the console for the root account.
I was able to run the manage.py syncdb and it seems that it
created the wanted application tables in the MySQL preinstalled
database. So far, so good.
I have added my application to the settings.py and to the urls.py.
Now I need the equivalent of the restart of the previously
used development server (manage.py runserver). I have found
something about "touch .wsgi", but I am not sure if it holds also
for the Django Turnkey Linux installation.
How can I do that without the need to restart the virtual machine?
Can you help me here?
Thanks,
Petr
- Turnkey is basically a LAMP stack with mod_wsgi on top of Ubuntu. Just
sharing that information will attract plenty more answers from people
who may not be familiar with Turnkey per se, but have similar stacks.
Heading over to turnkey forums will get you great help too.
- The quick and dirty way to install a django app in Turnkey is to
overwrite the sample 'project' folder in /var/www (or over any other
working project there). Do keep the wsgi_handler.py from the original
though, and paste it back in.
- Just copying your data over to a folder in /var/www won't cut it. You
will need to configure.
1. First make a wsgi configuration file. The wsgi_handler in the sample
project is a great start. This can have any name is what you may hear
called .wsgi elsewhere and this is the file you touch to restart the
project.
2. If going this route, you'll also need to make apache aware of your
new project. See what's already up there in the apache configuration for
the default project in terms of virtual hosts and copy/modify as needed.
A couple of apache shell commands make that easier too, but can't really
remember the specifics. Generic tips and documentation will help there.
After all's done restart apache.
PS: I think I may have confused your meaning of 'application' in your
post and you're only adding to a working project. But since I wrote all
the above I'm leaving it there in case it helps someone else. In that
case, just look at point 1. , in turnkey the .wsgi is named
wsgi_handler.py. Also scan it to see if it needs any changes (it may
happen that sys.path manipulations happen there that you need to take
into account)
Hope that my response doesn't sound all shitty to the more seasoned devs
out there, and I hope it helped even just a bit,
Nick
"Brett Epps" wrote...
> You'll need to do some research to find out how Turnkey Linux
Nick
> You'll want to use Python 2.7 if possible.
> You should also use Django 1.3.1 (the latest release).
This is what I was thinking about. So, I have to learn how to
update...
> I'd highly recommend learning how to use pip and virtualenv
> for installing Python packages and managing dependencies.
> Virtualenv gives you a virtual Python environment that is insulated
> from the system Python, which is nice in cases where
> the system Python environment includes old packages
> or ones you don't need.
... and this is very valuable info for me. And it also fits with
Nick's recommendations.
> For a database server, I prefer Postgres.
> Django should still work well if you choose
> the SQLite or MySQL routes though.
So far, I did use the SQLite for Django locally, but only
the way that is almost completely managed by Django.
The Django TurnKey Linux uses MySQL.
I am aware of Postgres as probably one of the most
matured SQL engines for free.
Thanks and have a good time,
Petr