Skip to content

Commit

Permalink
Feature/init (#1)
Browse files Browse the repository at this point in the history
* Init

* Init

Co-authored-by: Ronny Vedrilla <[email protected]>
  • Loading branch information
GitRon and Ronny Vedrilla authored Feb 25, 2022
1 parent f58fc7a commit ef42134
Show file tree
Hide file tree
Showing 20 changed files with 553 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,9 @@ dmypy.json

# Pyre type checker
.pyre/

# PyCharm
.idea/

# Playwright
auth.json
13 changes: 13 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
django = "==3.2.*"

[dev-packages]
playwright = "1.19"

[requires]
python_version = "3.9"
188 changes: 188 additions & 0 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,18 @@
# playwright-django-demo
Test project for combining playwrite and django

Test project for combining playwright and django

## Setup

Install/update pip and pipenv

> pip install -U pip pipenv
Install dependencies into virtualenv

> pipenv install --dev
Install playwright CLI tool

> playwright install
Empty file added apps/__init__.py
Empty file.
Empty file added apps/cat/__init__.py
Empty file.
8 changes: 8 additions & 0 deletions apps/cat/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from django.contrib import admin

from cat.models import Cat


@admin.register(Cat)
class CatAdmin(admin.ModelAdmin):
list_display = ('id', 'name', 'age')
6 changes: 6 additions & 0 deletions apps/cat/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.apps import AppConfig


class CatConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'cat'
22 changes: 22 additions & 0 deletions apps/cat/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Generated by Django 3.2.12 on 2022-02-25 12:43

from django.db import migrations, models


class Migration(migrations.Migration):

initial = True

dependencies = [
]

operations = [
migrations.CreateModel(
name='Cat',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=50)),
('age', models.PositiveSmallIntegerField()),
],
),
]
Empty file added apps/cat/migrations/__init__.py
Empty file.
9 changes: 9 additions & 0 deletions apps/cat/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from django.db import models


class Cat(models.Model):
name = models.CharField(max_length=50)
age = models.PositiveSmallIntegerField()

def __str__(self):
return self.name
Empty file added apps/config/__init__.py
Empty file.
16 changes: 16 additions & 0 deletions apps/config/asgi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""
ASGI config for playwright_test project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/howto/deployment/asgi/
"""

import os

from django.core.asgi import get_asgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'playwright_test.settings')

application = get_asgi_application()
22 changes: 22 additions & 0 deletions apps/config/manage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys


def main():
"""Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'apps.config.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
) from exc
execute_from_command_line(sys.argv)


if __name__ == '__main__':
main()
Loading

0 comments on commit ef42134

Please sign in to comment.