Changes between Version 89 and Version 90 of IrcFAQ
- Timestamp:
- Jan 9, 2009, 9:55:08 AM (16 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
IrcFAQ
v89 v90 47 47 Have you looked here? http://code.djangoproject.com/wiki/WindowsInstall 48 48 49 == What should I use for development -- the built-in server, mod_python, FastCGI? == #WhichServer50 51 It's generally easiest to use the [http://www.djangoproject.com/documentation/django-admin/#runserver-optional-port-number-or-ipaddr-port built-in development server] for development, since it automatically reloads your Python source files when it detects changes. Apache needs to be restarted to see changes to your source files (unless you set {{{MaxRequestsPerChild 1}}}, which you should do with caution since it is not suitable for production).52 53 Some prefer to replicate the production environment as closely as possible, meaning that if their deployed project uses mod_python then their development server does as well.54 55 == What database should I use? == #WhichDB56 57 For development, most people find SQLite to be fastest and simplest to run with -- just make sure the database file and its directory are writeable by the owner of the web server process. For production, PostgreSQL and MySQL are the most thoroughly-tested of the databases Django supports, but it's best to choose based on the needs of your applications; for example, applications which do very little writing of data to the DB will enjoy the speed of SQLite, but applications which involve many complex queries or which require robust concurrent-write features like transaction isolation will probably want to look at Postgres or MySQL (and, of course, MySQL is often handy simply because many shared hosting providers have it set up by default).58 59 60 49 = Troubleshooting = 61 50 … … 73 62 74 63 [http://dpaste.com/ Pasting] your code is often helpful. Don't forget to set the syntax when you paste so that the proper colorizing is applied -- that makes it easier for us to read your stuff. The Django debug page has a handy button for automatically sharing traceback code. 75 76 == I'm using the development version (via Subversion) and when I ran "svn up" a bunch of stuff broke! == #SvnUp77 78 If you use the development version of Django, follow the BackwardsIncompatibleChanges and the [http://code.djangoproject.com/timeline timeline], so you can see what has changed *before* you update.79 80 That way, changes like [http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges#Auto-escapingintemplates auto-escaping of HTML in templates] won't catch you by surprise.81 64 82 65 == My media/static files (CSS, images, etc.) aren't showing up. == #MediaTroubles … … 128 111 Both mod_python and FastCGI are structured in such a way that there's no such thing as "application startup" or "server startup"; the best solution is to place your "startup" code somewhere that's guaranteed to be imported early on in the request/response cycle (the `__init__.py` file of your project, or of a specific application you're using, can be a good place, because Python will execute code found there the first time it has to import the module; just be aware that referencing the same module in different ways, say by doing `from myproject.myapp import foo` in one place, and `from myapp import foo` in another, will cause that code to be executed once for each different way you import it). 129 112 130 == Do I have to hard-code my media URL in all my templates for CSS, images and Javascript? == #MediaURL131 132 No; you can use {{{{{ MEDIA_URL }}}}}. If you're using generic views, you can use {{{{{ MEDIA_URL }}}}} without changing anything.133 134 If you're using render_to_response(), you'll have to include RequestContext, as described here: http://docs.djangoproject.com/en/dev/ref/templates/api/#subclassing-context-requestcontext135 136 If you're using 0.96 or later, you can get the same functionality by creating a template context processor, as described: http://www.b-list.org/weblog/2006/jun/14/django-tips-template-context-processors/137 138 139 113 == How do I use Django in a shell script? == #Shell 140 114 141 115 http://www.b-list.org/weblog/2007/sep/22/standalone-django-scripts/ 142 116 143 == Can I use the Date/Time picker !JavaScript from the Admin in my own app? == #DatePicker144 Short answer: No.145 146 Long answer: It is possible, but requires reusing the Admin JS and CSS, and is more trouble than it is worth. Most !JavaScript frameworks (such as [http://developer.yahoo.com/yui/ YUI], [http://dojotoolkit.org/ Dojo], [http://jquery.com/ jQuery], and [http://www.prototypejs.org/ Prototype]) provide similar functionality, either out of the box or through plugins. Additionally, there are many !JavaScript snippets available across the Web.147 148 117 == I want to repeat a bit of dynamic information (eg from a database) on many views. Do I have to change every view? == 149 118 150 119 No, you can use an [http://www.djangoproject.com/documentation/templates_python/#inclusion-tags inclusion tag]. 151 152 == If I change my model, will {{{manage.py syncdb}}} update my database table? == #ModelChanges153 154 No, you'll need to manually change your database table. If you use `manage.py sqlall` on your app to produce a SQL file before editing your models, you can run it again afterwards and use the difference between the two to see what you need to change in the database.155 156 120 157 121 … … 163 127 164 128 You can learn more about Python's handy profiling tools in the [http://docs.python.org/lib/profile.html Python documentation]. 165 166 == What editor is best for Django? == #WhichEditor167 168 [wiki:UsingVimWithDjango Vim]. No, wait, [wiki:Emacs Emacs]. A lot of people seem to like TextMate, too. The best editor is the editor ''you'' prefer.169 129 170 130 == Where can I find example code and/or reusable apps? == #ShowMeTheCode … … 188 148 189 149 Yes, it's very handy -- see DjangoBot for more. 150