Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

405
Vistas
CommandError in django while using call_command(startapp, app_name)

I want to create a Django app from user input. Here is my code.


def createAppname(name):
    split_name = name.split(" ")
    
    s = "".join(i[0:] for i in split_name)
    return s

def formFields(request):
    if request.method == 'POST':
        app_name =  request.POST.get('app')

        new_name=createAppname(app_name)

        from django.core.management import call_command
        call_command('startapp', new_name)

        return render(request,'forms_new.html')

    return render(request, 'forms_new.html')

The code works perfectly when I am executing in the development environment. But after deploying on the production server, here I'm using apache_mod_wsgi, I get the following error.



Traceback (most recent call last):
  File "/path/to/env/lib/python3.6/site-packages/django/core/management/templates.py", line 70, in handle
    os.makedirs(top_dir)
  File "/path/to/env/lib/python3.6/os.py", line 220, in makedirs
    mkdir(name, mode)

During handling of the above exception ([Errno 13] Permission denied: '/thisisnewappfromServer'), another exception occurred:
  File "path/to/env/lib/python3.6/site-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/path/to/env/lib/python3.6/site-packages/django/core/handlers/base.py", line 179, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/home/rohit/Documents/Web_app/project/new_models/views.py", line 70, in formFields
    call_command('startapp', new_name)
  File "/path/to/env/lib/python3.6/site-packages/django/core/management/__init__.py", line 168, in call_command
    return command.execute(*args, **defaults)
  File "/path/to/env/lib/python3.6/site-packages/django/core/management/base.py", line 371, in execute
    output = self.handle(*args, **options)
  File "/path/to/env/lib/python3.6/site-packages/django/core/management/commands/startapp.py", line 14, in handle
    super().handle('app', app_name, target, **options)
  File "/path/to/env/lib/python3.6/site-packages/django/core/management/templates.py", line 74, in handle
    raise CommandError(e)

Exception Type: CommandError at /models/details/
Exception Value: [Errno 13] Permission denied: '/thisisnewappfromServer'

Please help me out here. Thanks.

over 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda