Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Django Basics What a View! Running the Server

Yuvaraj Arumugam
Yuvaraj Arumugam
4,384 Points

Exception shown, while running 'python3 manage.py migrate' or 'python3 manage.py runserver 0.0.0.0 8000' django command

After creating a project learning_site, I am running the following commands,

'python3 manage.py runserver 0.0.0.0 8000' 'python3 manage.py migrate'

Both commands show the following exception message,

Traceback (most recent call last): File "manage.py", line 22, in <module> execute_from_command_line(sys.argv) File "/usr/local/lib/python3.5/site-packages/django/core/management/init.py", line 367, in execute_from_command_line utility.execute() File "/usr/local/lib/python3.5/site-packages/django/core/management/init.py", line 359, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/usr/local/lib/python3.5/site-packages/django/core/management/base.py", line 294, in run_from_argv self.execute(*args, **cmd_options) File "/usr/local/lib/python3.5/site-packages/django/core/management/base.py", line 345, in execute output = self.handle(*args, **options) File "/usr/local/lib/python3.5/site-packages/django/core/management/commands/migrate.py", line 83, in handle executor = MigrationExecutor(connection, self.migration_progress_callback) File "/usr/local/lib/python3.5/site-packages/django/db/migrations/executor.py", line 20, in init self.loader = MigrationLoader(self.connection) File "/usr/local/lib/python3.5/site-packages/django/db/migrations/loader.py", line 52, in init self.build_graph() File "/usr/local/lib/python3.5/site-packages/django/db/migrations/loader.py", line 203, in build_graph self.applied_migrations = recorder.applied_migrations() File "/usr/local/lib/python3.5/site-packages/django/db/migrations/recorder.py", line 65, in applied_migrations self.ensure_schema() File "/usr/local/lib/python3.5/site-packages/django/db/migrations/recorder.py", line 56, in ensure_schema with self.connection.schema_editor() as editor: File "/usr/local/lib/python3.5/site-packages/django/db/backends/sqlite3/schema.py", line 25, in enter self._initial_pragma_fk = c.fetchone()[0] TypeError: 'NoneType' object is not subscriptable

Please help to proceed further.

3 Answers

Erika Suzuki
Erika Suzuki
20,299 Points

Yuvaraj Arumugam you're missing a colon on your host name. Do it like this.

python manage.py runserver 0.0.0.0:8000

Actually you could omit the last part, the host. Just run python manage.py runserver it's much simpler. Your site will run on localhost:8000

Dmitry Bruhanov
Dmitry Bruhanov
8,513 Points

Hey, Try omitting 3 in your python3 comand like this: python manage.py runserver It worked for me just fine)