Instalar Django en Debian

Guía práctica para configurar Django en Debian: instalación, entorno virtual, PostgreSQL y despliegue seguro con Gunicorn y Nginx, con buenas prácticas DevOps y seguridad.

2 sept 2025 • 2 min read • Q2BSTUDIO Team

Inteligencia-Artificial-

Setup Django en Debian Guía práctica y actualizada para desarrolladores y equipos de TI. En Q2BSTUDIO, empresa de desarrollo de software y tecnología, creamos aplicaciones a medida, software a medida, soluciones de inteligencia artificial, ciberseguridad, servicios cloud AWS y Azure, servicios de inteligencia de negocio y power bi, automatización de procesos y agentes IA. Si necesitas un socio técnico para acelerar tu proyecto, podemos ayudarte con arquitectura, despliegue y buenas prácticas. Conoce nuestros servicios de aplicaciones a medida y software a medida y potencia tus productos con inteligencia artificial para empresas.

1 Actualizar el sistema Ejecuta: sudo apt update && sudo apt upgrade -y

2 Instalar dependencias básicas Instala Python 3, pip, venv, compiladores y librerías necesarias para paquetes con extensiones en C: sudo apt install -y python3 python3-pip python3-venv build-essential libssl-dev libffi-dev python3-dev git curl

3 Crear un entorno virtual recomendado mkdir ~/mi_proyecto cd ~/mi_proyecto python3 -m venv venv source venv/bin/activate Para desactivar: deactivate

4 Actualizar pip e instalar Django pip install --upgrade pip pip install django Verificar versión: django-admin --version

5 Crear un proyecto Django django-admin startproject mi_proyecto . El punto crea el proyecto en la carpeta actual.

6 Configurar base de datos opcional Por defecto Django usa SQLite, suficiente para desarrollo. Para producción se recomienda PostgreSQL. Instalación: sudo apt install -y postgresql postgresql-contrib libpq-dev Crear usuario y base: sudo -u postgres createuser mi_usuario -P sudo -u postgres createdb mi_banco -O mi_usuario Driver de Python: pip install psycopg2-binary Configurar en settings.py: DATABASES = { default: { ENGINE: django.db.backends.postgresql, NAME: mi_banco, USER: mi_usuario, PASSWORD: tu_contraseña, HOST: localhost, PORT: 5432 } }

7 Aplicar migraciones iniciales python manage.py migrate

8 Crear usuario administrador python manage.py createsuperuser Sigue las indicaciones de nombre, correo y contraseña.

9 Probar el servidor de desarrollo python manage.py runserver Accede en el navegador: https://127.0.0.1:8000/ Panel admin: https://127.0.0.1:8000/admin/

10 Configurar Django REST Framework opcional pip install djangorestframework Añade en settings.py dentro de INSTALLED_APPS: rest_framework

11 Consejos extra para producción Usa Gunicorn y Nginx para servir la aplicación. Configura variables sensibles con un archivo .env y librerías como python-decouple. Define ALLOWED_HOSTS y configura la recogida de estáticos con collectstatic y, si procede, WhiteNoise. Habilita firewall con ufw permitiendo solo los puertos necesarios 22 80 443. Considera contenedores con Docker y orquestación con Docker Compose o Kubernetes. Para despliegues en la nube, nuestros servicios cloud AWS y Azure te ayudan con CI CD, alta disponibilidad y observabilidad.

Por qué Q2BSTUDIO Somos especialistas en desarrollo de software a medida, ciberseguridad, ia para empresas, agentes IA, servicios inteligencia de negocio y power bi. Integramos buenas prácticas DevOps, observabilidad y seguridad desde el inicio del proyecto, y construimos plataformas escalables para que tu producto crezca con tu negocio. Si buscas acelerar tu Setup Django en Debian y llevarlo a producción de forma segura y eficiente, hablemos.

A BREAK?

Play for a moment before you go

OUR SERVICES

How we can help you

Artificial intelligence

AI agents, chatbots, and intelligent assistants that automate tasks and serve your customers 24/7 to improve the efficiency of your business.

More info

Software Development

Web, mobile, and desktop applications, intranets, e-commerce, SaaS, and management platforms designed for your company's specific needs.

More info

Cloud services

Migration, infrastructure, managed hosting, high availability, and security on Microsoft Azure and Amazon Web Services to help your business scale without limits.

More info

Cybersecurity and pentesting

Security audits, penetration testing and protection of applications, data and infrastructure on-premise and cloud, with ethical hacking and regulatory compliance.

More info

Business Intelligence

Dashboards and data analysis with Power BI: we integrate your sources, design dashboards and KPIs and turn your data into decisions.

More info

Process automation

We automate repetitive tasks and connect your applications with n8n, Power Automate, Make, and RPA, eliminating manual work and increasing productivity.

More info

Training for Companies

We train your teams in technology with criteria: web development, databases, Git, best practices and security, automation with n8n, artificial intelligence for companies and creation of AI solutions with Azure AI Foundry.

More info

Code Auditing

We audit the code that you, your team or an AI create: we tell you what is good and what to improve, we secure it and make it ready for production, web or app.

More info

AI Image Generation

We create for you the images that your business needs with artificial intelligence: product, networks, advertising, illustration and avatars. You tell us what you want and we deliver it ready to use.

More info

AI Video Generation

We create videos with artificial intelligence for you: promotional, networking, virtual presenters, dubbing and animations. You tell us the idea and we will deliver it assembled and ready to publish.

More info

AI Conversational Avatars

We create conversational avatars with AI – digital humans with a face and voice – that serve your customers and teams with the knowledge of your company, on your website, interactive monitors, WhatsApp or Teams.

More info

Online Marketing and AI

Google Ads, Meta Ads, LinkedIn Ads and AI Engine Positioning (GEO/AEO): we attract customers and make your brand appear where they search for you, also on ChatGPT, Gemini and Perplexity.

More info

Do you have a project in mind?

Tell us your vision and we'll turn it into a software solution. Whatever the scope, we make your idea real.

Live Chat