TurnKey Linux Virtual Appliance Library

Django new project

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

Liraz Siri's picture

Documentation

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

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

Guest's picture

Project

I think the Documentation link in the right is the project. As per what I know (newbee). The main screen itself is the Django Project. 

Guest's picture

Can't figure out why root index point to django-sites/apps

Hi all

I'm trying to figure out where is the setting that makes apache root point to django-sites/apps.

Since I'm trying to publish an existing project, I need to find the way to set it up as root project
instead of default "apps" project

How can this be done?

Thanks in advance!

Alon Swartz's picture

Apache configuration

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

having problems setting up the database.

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

TBH I don't know but I would try using the DB name - no path

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...

Post new comment

The content of this field is kept private and will not be shown publicly. If you have a Gravatar account, used to display your avatar.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <p> <span> <div> <h1> <h2> <h3> <h4> <h5> <h6> <img> <map> <area> <hr> <br> <br /> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <em> <b> <u> <i> <strong> <font> <del> <ins> <sub> <sup> <quote> <blockquote> <pre> <address> <code> <cite> <strike> <caption>

More information about formatting options

Leave this field empty. It's part of a security mechanism.
(Dear spammers: moderators are notified of all new posts. Spam is deleted immediately)