Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

343
Visualizações
Can't seem to setup my Django project properly

I was trying the official tutorial of Django because I want to learn it. I run Archlinux 4.10.11-1 64 bits.

First, I created a folder named djangoapp where I set my virtual environment:

$ virtualenv djangoapp

I set my current directory to this folder, and then I activated it:

$ source bin/activate

And I installed Django after:

$ pip install django

Following the tutorial, I ran:

$ django-admin startproject djangoapp

And set my current directory to djangoapp, and ran:

$ python manage.py runserver

But I'm getting the following error:

django.core.exceptions.ImproperlyConfigured: Requested setting DEBUG, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.

Indeed, running env | grep DJANGO_SETTINGS_MODULE gets me the following result:

DJANGO_SETTINGS_MODULE=

So I tried to set it manually:

$ export DJANGO_SETTINGS_MODULE='djangoapp.settings'

Running $ python manage.py runserver now works, but $ django-admin help now gets me the following error:

ModuleNotFoundError: No module named 'djangoapp'

What did I do wrong? Thanks for your help!

PS: $ python --version gets me Python 3.6.1.

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

I think the docs could be a little clearer about this, but django-admin is typically only used for running django-admin startproject and manage.py is used for the rest e.g. ./manage.py runserver, ./manage.py migrate etc.

Deleting the DJANGO_SETTINGS_MODULE environment variable should allow you to run both ./manage.py * and django-admin startproject commands when inside the djangoapp folder.

I'm not sure how to do this on Archlinux, but something like unset DJANGO_SETTINGS_MODULE or set -e DJANGO_SETTINGS_MODULE should work.

Further info: you can think of manage.py as a wrapper around django-admin that automatically sets the PYTHONPATH and DJANGO_SETTINGS_MODULE environment variables. Therefore, once inside the project, you can just use ./manage.py rather than django-admin to run the management commands.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda