How do I set up for Django/Web development in Ubuntu?
-
I'm trying to learn Django by doing, and I've got a project to tinker with. It's actually a real Web site that I had a Django programmer create for me, but now it's wholly in my hands and I want to tinker with and improve it. I've got Django installed and can run a simple development environment in Ubuntu, but I don't know how to run a "real" local environment where I can: (a) import a large MySQL database; (b) set up the site to run on my local box; (c) use version control and only upload "good" changes online. Will I need Apache? Which version control system should I use for this? Where's the best place for newbies to read up on these things?
-
Answer:
Well Django comes in bundled with a development server so you don't need to use Apache for that. You can simply run the dev server by using http://manage.py runserver. The best way to begin with is the Django documentation - https://docs.djangoproject.com/en/1.4/ You will find everything you need there to get started. Be careful about the Django version that you install on your machine and the one in which your site is built. If its 1.3 and 1.4, you won't face any problem. You can install mysql db as sudo apt-get install mysql-server mysql-client and then you need to create a database in mysql and add its specifications in the settings file in your project. You will find how to do that in the documentation. You don't need to do much to import your database if the database you are importing is the one that has been generated by the same django project that you are moving to your local machine. That is because then your project will think that the tables that are in the database are the ones that have been created by it only, because it would have also created the same table names. However if the database that you are importing has not been created by the same django project then you should use the command inspectdb(https://docs.djangoproject.com/en/dev/howto/legacy-databases/) to create models out of an existing database. Finally coming to the question of which version control system you should use, I would strongly recommend using http://git-scm.com/ It's easy to use and you can get started quickly. There are loads of best practices you should be knowing about Django, but I think you will learn them as you keep tinkering with your project. As far as I know, the best practices to keep in mind is to write your code such that it remains clean and readable even if it becomes large. Having logical design of code. Also if possible, try to integrate unit test to your project as far as possible. Hope it helps :)
Sachin Gupta at Quora Visit the source
Other answers
If you just want to play around with it , you don't need apache, django has a builtin server for development. The django official documentation is really good. https://docs.djangoproject.com/en/1.4/ . All of your questions are answered in the official documentation To answer your specific questions (a) To import a mysql database , make sure you have mysql installed, Create models , change the http://settings.py file with your mysql configuration( server, port name , username, password), to play around with your tables you can run a python shell by using http://manage.py. Here you can write any mysql queries using django's model framework (b) To run a the site, you can again use http://manage.py, say python http://manage.py runserver and you have a development server running on port 8000 at localhost. (c) just push good changes online or create a branch for changes you would like to make and then merge the branch when you want to.
Anonymous
Related Q & A:
- How can I use SSL with django?Best solution by Stack Overflow
- How can I set up my computer to alert me when I get an incoming email?Best solution by Yahoo! Answers
- How do I set up my set top box?Best solution by Server Fault
- How do I set up a web page?Best solution by Yahoo! Answers
- How do I set up a web site for my non profit organization?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.