finga's picture

Hoi,

since several hours I try to create a Django project on a TurnKey Django installation. How can this be done? I am new to Django but i can't find any solution.

thx a lot

Forum: 
Liraz Siri's picture

You'll want to read through the Django documentation to get your bearings. As the appliance documentation states there's an example project at /var/www/django-sites/apps which you can try to learn from, but if you don't understand Django yet that may not be helpful.
finga's picture

Thx a lot, this helps very well. I've read many about Django these days so it wouldn't be hard to begin. :D

Alon Swartz's picture

You'll find the configuration in /etc/apache2/sites-available/django-sites.
Note that DJANGO_SETTINGS_MODULE is set to apps.settings.
Hope this helps.
John Draper's picture

I setup a new database,  I call it "tracker".  I setup a user called "django" to manage all my Django databases.  I setup "Database Permissions" to all.   

In my settings file,   I have...  

DATABASES = {

   'default' : {

          'ENGINE': 'django.db.backends.mysql',

          'NAME': '/var/lib/mysql/tracker',

          'USER': 'django',

          'PASSWORD': 'passwd',

          'HOST': '',

          'PORT':'',

   }

}

I verified that 'tracker' exists as a database,  but I didn't make any tables for it yet.   My first question,  do I have to create at least one table?    or when I type 'python manage.py syncdb',   I get the following...

/tracker# python manage.py syncdb
Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/lib/python2.7/dist-packages/django/core/management/__init__.py", line 443, in execute_from_command_line
    utility.execute()
  File "/usr/lib/python2.7/dist-packages/django/core/management/__init__.py", line 382, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/lib/python2.7/dist-packages/django/core/management/base.py", line 196, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/usr/lib/python2.7/dist-packages/django/core/management/base.py", line 231, in execute
    self.validate()
  File "/usr/lib/python2.7/dist-packages/django/core/management/base.py", line 266, in validate
    num_errors = get_validation_errors(s, app)
  File "/usr/lib/python2.7/dist-packages/django/core/management/validation.py", line 103, in get_validation_errors
    connection.validation.validate_field(e, opts, f)
  File "/usr/lib/python2.7/dist-packages/django/db/backends/mysql/validation.py", line 14, in validate_field
    db_version = self.connection.get_server_version()
  File "/usr/lib/python2.7/dist-packages/django/db/backends/mysql/base.py", line 415, in get_server_version
    self.cursor().close()
  File "/usr/lib/python2.7/dist-packages/django/db/backends/__init__.py", line 317, in cursor
    cursor = self.make_debug_cursor(self._cursor())
  File "/usr/lib/python2.7/dist-packages/django/db/backends/mysql/base.py", line 387, in _cursor
    self.connection = Database.connect(**kwargs)
  File "/usr/lib/python2.7/dist-packages/MySQLdb/__init__.py", line 81, in Connect
    return Connection(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/MySQLdb/connections.py", line 187, in __init__
    super(Connection, self).__init__(*args, **kwargs2)
_mysql_exceptions.OperationalError: (1045, "Access denied for user 'django'@'localhost' (using password: YES)")
root@django django_test/tracker# 
 
 
Jeremy Davis's picture

Something like this:

DATABASES = {
   'default' : {
          'ENGINE': 'django.db.backends.mysql',
          'NAME': 'tracker',
          'USER': 'django',
          'PASSWORD': 'passwd',
          'HOST': '',
          'PORT':'',
   }
}

AFAIK the full path only applies to when you use SQLite as your DB backend...

L. Arnold's picture

Regarding the inability to get into the admin panel (I assume this is the same subject) I expect this is because of the new Database declaration.  I expect the Admin is more hard wired than that (though I can't see in Admin where to define a new Database within Django.  Certainly can be done in MySQL but this won't nessicarily tie in with the App itself. 

I installed Django and had no problem getting in via Admin and also via Webshell.  I am using Firefox and Chrome both.  I have not tried on my android phone, just my Windows machine.

I doubt you will want to do Python coding with an IPAd but perhaps I am wrong.

There is not a "rich and creamy interface" with Django is there.  You noted you installed a Template?  I sure could use a Template vis a vis the back end.  What shows up in the Django Book sure looks better than what shows up on my first venture into the Django Admin page.  Seems a worthy project to get up to that level.

If you want to have a Django Ap show up instead of the Admin/WebShell/Webmin set of choices easiest is to do your configuring in Webmin - Apache.  Careful though.  Easy way also to break things.

I need to read the Django book.  Python is worth using, but it looks like.

Snowstorm.  About to have a power outage so I am going to sign off.

 

Add new comment