Common Django Issues
2011-04-11 12:20:56 | 0 Comment
I am following many programming language and library mailing lists and one of them is the Django group. Since the time I've started following the mailing list, I have seen the same questions flowing around and for that matter, I will write down two simple advices and solutions to common Django issues asked around constantly. Read the Django Documentation ----------- Django docs are one of the best documentations around on the web. Whatever it is you wonder, you need, you stuck is already mentioned in the documentation. Before jumping in and asking questions all the time, make a simple plan for your application, find out what you need or what you might need and read about them. Always start with the basic tutorial in the Django web site. Do not underestimate it because it's a simple application, it will open your eyes. Google Your Problem ---------- Whatever your problem / error / need / question is, it is most likely to be asked and answered already on the web. Before posting to the mailing list(s) or asking in the IRC rooms, just google it. If there is nothing pleasing you then go with the support channels. Long story short, google it! Back to common issues now. Is Django Suitable For X Kind of Web Application? ---------- Yes, it is. You can feel like it's more suitable for a CMS like web application however you are wrong. You can create any kind of web application with Django. You can create an e-commerce application, an ERP application, a CRM application, a simple blog system, a huge news system, anything you can imagine. Django Powered Web Sites ---------- From time to time, I see this question asked on both the mailing list and #django channel. You can just go visit [http://www.djangosites.org/](http://www.djangosites.org/) and browse Django powered web sites. They even have tags you can browse apps by. Django Admin Does Not Work For Me ---------- The reason is most likely that you have forgotten to enable it. Read more about it at [Django tutorial part 2](http://docs.djangoproject.com/en/1.3/intro/tutorial02/). Make sure you do everything written there. My Static Files Are Not Showing Up ---------- If your static files are not showing up, then you are doing it wrong. Visit the [Managing static files](http://docs.djangoproject.com/en/1.3/howto/static-files/) page and learn how to do it correctly. My Models Are Not Created ----------- It is because you have not added it to INSTALLED_APPS. I Cannot Access A Page ----------- Make sure you have set a corresponding rule in your `urls.py` and returning the correct response / template. How Do I Access Form Data? ----------- You can do that with `request.POST['field_name']` or `request.GET['field_name']`. In addition, if you are not sure if the field_name exists, accessing the field with `request.POST.get('field_name')` is a lot better. How Do I Deploy Django? ---------- [Deploying Django](http://docs.djangoproject.com/en/dev/howto/deployment/) page in the Django docs will help you. To be continued.