Skip to content

Instantly share code, notes, and snippets.

View mredvard's full-sized avatar

Edgar Contreras mredvard

View GitHub Profile
{
"cells": [
{
"cell_type": "code",
"execution_count": "",
"id": "96f9b477-6ebe-4741-8222-7f4520cda9d3",
"metadata": {
},
"outputs": [
@mredvard
mredvard / django_fastapi.md
Created April 20, 2024 12:43
Example of django fastapi integration by llama3 8B

Here is an example of how you can integrate Django and FastAPI:

Let's say we have a project that requires both backend functionality (using Django) and API endpoints (using FastAPI). We'll create a simple blog app with user authentication using Django, and add some API endpoints to retrieve and manipulate blog posts using FastAPI.

Step 1: Create a new Django project

Create a new Django project using django-admin startproject myblog. This will create a basic directory structure for our project.

Step 2: Create the Django app

@mredvard
mredvard / vue.html
Created February 23, 2024 03:46
vue3helloworld
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Hello World in Vue 3</title>
<script src="https://unpkg.com/vue@next"></script>
</head>
<body>
<div id="app">
import factory
from faker import Faker
from core.tests.utils import create_datetime_range
from .. import models
faker = Faker()
class PricingBlockFactory(factory.django.DjangoModelFactory):
#!/bin/bash
NAME="proyecto" # Name of the application
DJANGODIR=/opt/proyecto/django # Django project directory
SOCKFILE=/opt/proyecto/gunicorn.sock # we will communicte using this unix socket
PORT=8001 # if we communicate using tcp
USER=ed # the user to run as
GROUP=ed # the group to run as
NUM_WORKERS=5 # how many worker processes should Gunicorn spawn
DJANGO_SETTINGS_MODULE=proyecto.settings # which settings file should Django use
@mredvard
mredvard / gist:4734509
Created February 7, 2013 21:41
Celeryd error Command: python manage.py celeryd -l debug -c 4 Celeryd + RabbitMQ
[2013-02-07 15:33:34,078: ERROR/MainProcess] Error in timer: ConnectionError('Too many heartbeats missed', None, None, None, '')
Traceback (most recent call last):
File "/home/ubuntu/virtualenvs/bm/local/lib/python2.7/site-packages/celery/utils/timer2.py", line 97, in apply_entry
entry()
File "/home/ubuntu/virtualenvs/bm/local/lib/python2.7/site-packages/celery/utils/timer2.py", line 51, in __call__
return self.fun(*self.args, **self.kwargs)
File "/home/ubuntu/virtualenvs/bm/local/lib/python2.7/site-packages/celery/utils/timer2.py", line 153, in _reschedules
return fun(*args, **kwargs)
File "/home/ubuntu/virtualenvs/bm/local/lib/python2.7/site-packages/kombu/connection.py", line 264, in heartbeat_check
return self.transport.heartbeat_check(self.connection, rate=rate)